Skip to content

Added completion on fish shell for ml command - #657

Open
eveillesimon wants to merge 1 commit into
envmodules:mainfrom
eveillesimon:issue417
Open

Added completion on fish shell for ml command#657
eveillesimon wants to merge 1 commit into
envmodules:mainfrom
eveillesimon:issue417

Conversation

@eveillesimon

Copy link
Copy Markdown

Resolves issue #417.

Added completion for fish shell.
No additional files were needed.

ml command now supports all module command options and also adds the module available list as first complete option.

…nvmodules#417)

Signed-off-by: Simon Éveillé <simon.eveille@asplus.fr>

@xdelaruelle xdelaruelle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for this contribution.

In addition to the other comments to address, a global point is the need to have 2 distinct completion files when Modules installs its completion files in the regular system directory (/usr/share/fish/vendor_completions.d). If there is only a module.fish there, ml will not have its completion activated until a first module is run.

Maybe to address this point, a generic module.fish.in template file can be used to generate both module.fish and ml.fish from makefile (use new fish-completions directory to mimic ksh or zsh files).

There may be alternatives for ml.fish to source module.fish and produce a different evaluation of this script based on its filename.

Comment thread init/fish_completion
complete -c $command -l width= --description 'Set output width'
complete -c $command -l ignore-cache --description 'Ignore $command cache'
complete -c $command -l ignore-user-rc --description 'Skip evaluation of user-specific $command rc file'
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several tailing blank space that should be trimmed.

Comment thread init/fish_completion
complete -c $command -s p -l paginate --description 'Pipe mesg output into a pager if stream attached to terminal'
complete -c $command -s P -l no-pager --description 'Do not pipe message output into a pager'
complete -c $command -l auto --description 'Enable automated $command handling mode'
complete -c $command -l no-auto --description 'Disable automated $command handling mode'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"module" word should not be replaced by "$command" in descriptions

Comment thread init/fish_completion
return 1
end

set commands module ml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put this set definition next to its for usage

Comment thread init/fish_completion
set commands module ml


complete -c ml -n '__fish_ml_avail' -f -a "(module avail --color=never -s -t -S --no-indepth -o 'alias:indesym' (commandline -ct) 2>&1)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • arguments after the first one do not list the available modules
  • -<TAB> does not list the loaded modules that can be unloaded (in addition to options)

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

Successfully merging this pull request may close these issues.

2 participants