Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add completions for Nushell #5

Closed
avi-cenna opened this issue Oct 21, 2023 · 2 comments
Closed

Feature request: Add completions for Nushell #5

avi-cenna opened this issue Oct 21, 2023 · 2 comments

Comments

@avi-cenna
Copy link

Would be nice to have completions for Nushell. I have some experience with Nushell, so I could probably tackle this myself if that's ok.

@xylous
Copy link
Owner

xylous commented Oct 21, 2023

This should do, I reckon? It requires only one more crate and is otherwise trivial to implement, although since I don't use Nushell myself I can't test whether it works or not. Try compiling this and running settle compl nu or settle compl nushell, or alternatively use what the command generated without compiling it yourself:

module completions {

  # CLI tool to manage a digital Zettelkasten
  export extern settle [
    --help(-h)                # Print help
    --version(-V)             # Print version
  ]

  # sync the database
  export extern "settle sync" [
    --project(-p): string     # helper option to --create and --move; specify working project
    --create(-c): string      # create a new Zettel
    --update(-u): string      # update a note's metadata, given its path
    --generate(-g)            # (re)generate the database
    --move(-m): string        # move the matching Zettel to a project; requires --project
    --rename(-n): string      # rename a note, preserving project and updating backlinks
    --help(-h)                # Print help
  ]

  # query the database
  export extern "settle query" [
    --title(-t): string       # keep Zettel with a matching title
    --project(-p): string     # keep Zettel that are in the matching projects
    --tag(-g): string         # keep Zettel that have a matching tag name
    --text(-x): string        # keep Zettel that contain some text
    --links(-l): string       # keep Zettel that have links to the matching Zettel
    --backlinks(-b): string   # keep Zettel that have links from the matching Zettel
    --loners(-o)              # keep Zettel that don't have any links to and fro
    --format(-f): string      # print formatted
    --link_sep(-s): string    # specify separator for links and backlinks in formatted output
    --graph: string           # turn the query results into a graph: 'dot', 'json' or 'vizk'
    --exact(-e)               # match everything exactly, disabling regex
    --help(-h)                # Print help
  ]

  # list things not related to notes
  export extern "settle ls" [
    OBJECT: string            # object to list (tags, projects, ghosts, path)
    --help(-h)                # Print help
  ]

  # generate completion file for a given shell
  export extern "settle compl" [
    SHELL: string
    --help(-h)                # Print help
  ]

  # Print this message or the help of the given subcommand(s)
  export extern "settle help" [
  ]

  # sync the database
  export extern "settle help sync" [
  ]

  # query the database
  export extern "settle help query" [
  ]

  # list things not related to notes
  export extern "settle help ls" [
  ]

  # generate completion file for a given shell
  export extern "settle help compl" [
  ]

  # Print this message or the help of the given subcommand(s)
  export extern "settle help help" [
  ]

}

export use completions *

@avi-cenna
Copy link
Author

@xylous Thank you! I installed settle and then sourced the completions file from nushell and completions are working as expected.

@xylous xylous closed this as completed Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants