xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.7k stars 189 forks source link

nb import Filename Tab Completion not working #59

Open tjortho opened 4 years ago

tjortho commented 4 years ago

Tab completion of filenames fails to work with nb import.... Many of these are long filenames and paths, so it is a vital part of the workflow.

It appears the context for tab completion after typing "import" remains WITHIN the notebook structure, rather than the shell filesystem command line completion.

Workaround for the moment is to 'ls' with tab completion, then nb import $!

xwmx commented 4 years ago

Yeah, so far tab completion has only been implemented for notebook and command names. This should improve as time permits.

If anyone reading this wants to expand the completion scripts, this would be a good way to contribute.

delphinus commented 4 years ago

I've been working on improving completion on fish (#63). I will implement this feature on that PR (for fish only).

docsteveharris commented 3 years ago

Tab completion of filenames fails to work with nb import.... Many of these are long filenames and paths, so it is a vital part of the workflow.

It appears the context for tab completion after typing "import" remains WITHIN the notebook structure, rather than the shell filesystem command line completion.

Workaround for the moment is to 'ls' with tab completion, then nb import $!

Thanks for raising this issue. Could you explain how to implement the workaround? Are you piping the output of ls to nb import or similar? I've tried that and can't get it to work. 🙏

xwmx commented 3 years ago

@docsteveharris You should still be able to specify the filenames individually or using globbing:

# import "example.md" in the current directory
nb import example.md

# import "example.md" in the current directory and "sample.md" in the "demo" directory
nb import example.md demo/sample.md

# import all .md markdown files in the current directory
nb import *.md

# import all files in the "demo" directory
nb import demo/*

I like your intuition about piping filenames / paths to nb import, so I just added that. It's available in the repo now and will be in the next point release.