jupyter_core
jupyter_core copied to clipboard
Complete notebook files in ZSH completion
Hi, I’m trying to get jupyter notebook <tab>
to show me both subcommands and notebook files as options here.
sadly i don’t seem to get what’s going on. whatever i tried, it throws errors at some point.
can somebody explain how it works? my progress:
-
${(P)subcmd}}
means “expand to the value of the variable named$subcmd
”. i.e. ifsubcmd=notebook
, it expands to$notebook
, which is previously set to the output of$(jupyter notebook --help-all | grep … | sed …)
so
${(P)subcmd}}
aka$notebook
(in one branch) holds the_arguments
-formatted options to thenotebook
subcommand -
_${subcmd}_cmds
aka_notebook_cmds
(in one branch) holds_describe
output.
below my most recent attempts:
-
eval-string
_alternative \ 'notebook:notebook:_files -g "*.ipynb"' \ "subcommands:subcommands:{_${subcmd}_cmds && echo ${(P)subcmd}}" && ret=0
at some point it prints the stuff instead of using it… do i have to do this? is there a better way?
_alternative … "subcommands:subcommands:{$(_${subcmd}_cmds && echo ${(P)subcmd})}"
-
function
_cmds_and_opts() { _${subcmd}_cmds echo ${(P)subcmd} } _alternative \ 'notebook:notebook:_files -g "*.ipynb"' \ "subcommands:subcommands:_cmds_and_opts" && ret=0
huh? can’t i redefine functions? or what’s wrong
This seems to be a zsh question, rather than a jupyter_core issue. I suggest to close this issue as off-topic.
this repo contains the ZSH file completions-zsh
this is a feature request for that file, therefore this issue was filed in the ideal place.
sorry if i didn’t make that clear: i want to improve the ZSH completions here.
Has any progress been made on this issue?
Not as far as I known. Would you like to work on it?
Not as far as I known. Would you like to work on it?
I don't have much spare time, by considering nobody else has replied, I'll take a crack at it.