cristianpjensen / inkscape-figures-manager-rs

Shortcuts for making technical figures fast in Inkscape, in macOS.
9 stars 1 forks source link

Error while creating figure #5

Closed anandkumar89 closed 1 month ago

anandkumar89 commented 6 months ago

Don't know much rust, can't figure out why is this error cropping up

error: unexpected argument '-f' found

  tip: to pass '-f' as a value, use '-- -f'

Usage: inkscape-figures-manager new <PATH>
cristianpjensen commented 6 months ago

Sorry for the late response. What was the exact command you tried?

PseudoMagnifique commented 1 month ago

I had the same problem. I typed 'test' in a tex file and then used ctrl+F in insert mode, thinking it would create a svg figure named test.svg in a figures directory, just like with Gilles Castel's Inkscape figure manager your project is inspired by. Instead, I got the following result in my tex file:

test
error: unexpected argument '-f' found

  tip: to pass '-f' as a value, use '-- -f'

Usage: inkscape-figures-manager new <PATH>
cristianpjensen commented 1 month ago

@PseudoMagnifique Did you add the following to your Neovim config?

vim.keymap.set(
    "i",
    "<C-f>",
    "<Esc><cmd>exec 'r!inkscape-figures-manager new -f -d figures -l \"'.getline('.').'\"'<CR>kkkkkkddjjjf{a"
)

Also, what does the following command return (-f should be a valid option)?

inkscape-figures-manager new --help
PseudoMagnifique commented 1 month ago

Yes, I added the keymap to my keymaps config file. I just proofread it, and there is no spelling mistake.

The inkscape-figures-manager new --help commands returns the following output:

Creates a new figure for the current document. Give the path to the figure, including the `figures/` subdirectory. E.g., `ifm new figures/my_figure.svg`. Make sure that `$HOME/.config/ifm/template.svg` exists, since that will be the template that will be copied to the new file

Usage: inkscape-figures-manager new <PATH>

Arguments:
  <PATH>

Options:
  -h, --help  Print help

(And I also checked that the $HOME/.config/ifm/template.svg existed.)

cristianpjensen commented 1 month ago

@PseudoMagnifique What version did you install? I.e., what does inkscape-figure-managers --version return? If you look at the current version of the code, the new command should have multiple arguments, i.e., the above command should return the following,

Creates a new figure for the current document. Give the path to the figure, including the `figures/` subdirectory. E.g., `ifm new figures/my_figure.svg`. Make sure that `$HOME/.config/ifm/template.svg` exists, since that will be the template that will be copied to the new file

Usage: inkscape-figures-manager new [OPTIONS] <PATH>

Arguments:
  <PATH>

Options:
  -l, --latex                  Prints a LaTeX template for the figure
  -f, --format-path            Lowercases, replaces spaces by dashes, and adds the file extension to the path
  -d, --directory <DIRECTORY>  Sets the directory of the figure. Can be used in conjunction with `format-path` to set the directory and format the path at the same time. E.g., `ifm new my_figure --format-path --directory figures "..."` [default: ]
  -h, --help                   Print help
cristianpjensen commented 1 month ago

@PseudoMagnifique I found the issue. I hadn't published the cargo crate update to v0.2.0. I have now. Run cargo install inkscape-figures-manager@0.2.0 and let me know if it works.

PseudoMagnifique commented 1 month ago

It works!

After creating a figures/ directory, pressing ctrl+F while in insert mode acts as expected.