Inlyne-Project/inlyne

Add an `--edit-config` flag

Closed this issue · 2 comments

(Opening an issue for this, so that I don't forget about it)

It would be cool if:

  • The [config] file was automatically created (no copying neccessary)
  • And ideally if there was a keyboard shortcut or some other way to open to file (or at least view it's path)

Originally posted by @nicoburns in #124 (comment)

Should the --edit-config flag circumvent opening a markdown file? e.g. inlyne --edit-config vs inlyne some.md --edit-config.

Yes that would make sense, but I'm actually leaning towards making it a config subcommand instead, so that we can add other actions in the future like config set <key> <val> or config path, so I think --edit-config would fit best as inlyne config open probably?

I think overall I'm thinking

inlyne [FILE] [COMMAND]

Commands:
config  do config things
view    view a markdown document

Arguments:
[FILE]  markdown file to view

That way you can do things like

$ inlyne config open  # opens the config in an editor
$ inlyne README.md    # views the file "README.md"
$ inlyne view config  # views the file "config"

It does add in the edge cases of passing a file and a command, and passing neither which should both be CLI errors

Also worth noting that we can switch back to clap's derive API since we no longer need the full flexibility of the builder API