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

shell-completion files are out of date #2919

Open
fixeria opened this issue Sep 27, 2024 · 3 comments
Open

shell-completion files are out of date #2919

fixeria opened this issue Sep 27, 2024 · 3 comments

Comments

@fixeria
Copy link

fixeria commented Sep 27, 2024

Environment

ArchLinux https://aur.archlinux.org/packages/rebar3

Rebar3 report
 version 3.24.0
 generated at 2024-09-27T19:58:50+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: 
Entered as:
  
-----------------
Operating System: x86_64-pc-linux-gnu
ERTS: Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Root Directory: /usr/lib/erlang
Library directory: /usr/lib/erlang/lib
-----------------
Loaded Applications:
bbmustache: 1.12.2
certifi: 2.13.0
cf: 0.3.1
common_test: 1.27.1
compiler: 8.5.2
crypto: 5.5.1
cth_readable: 1.5.1
dialyzer: 5.2.1
edoc: 1.3.2
erlware_commons: 1.7.0
eunit: 2.9.1
eunit_formatters: 0.5.0
getopt: 1.0.2
inets: 9.3
kernel: 10.1
providers: 1.9.0
public_key: 1.16.2
relx: 4.9.0
sasl: 4.2.2
snmp: 5.17
ssl_verify_fun: 1.1.6
stdlib: 6.1
syntax_tools: 3.2.1
tools: 4.1

-----------------
Escript path: /usr/bin/rebar3
Providers:
  alias app_discovery as clean compile compile completion cover ct deps dialyzer do edoc escriptize eunit get-deps help install install_deps list lock manifest new path pkgs release relup report repos shell state tar tree unlock update upgrade upgrade upgrade vendor version xref 

Current behaviour

shell-completion files are missing some commands:

  • rebar3 local (upgrade|install)
  • rebar3 get-deps (perhaps the same as deps?)
  • rebar3 completion
  • rebar3 do <TAB>
  • rebar3 plugins <TAB> (missing sub-commands: upgrade, list)

and commands are missing some parameters, like:

  • rebar3 shell --<TAB>
    • --config
    • --name
    • --sname
    • --setcookie
    • --script
    • --apps
    • --relname
    • --relvsn
    • --start-clean
    • --env-file
    • --user_drv_args
    • --eval
  • rebar3 eunit --<TAB>
    • --error_on_warning (no longer exists, Invalid option --error_on_warning on task eunit)
    • --profile (can be also done using env var REBAR_PROFILE)
    • --module
    • --test
    • --generator
    • --name
    • --sname
    • --sys_config
    • --setcookie
  • rebar3 dialyzer <TAB>
    • --incremental
    • --base-plt-location
    • --plt-location
    • --plt-prefix
    • --app
    • --base-plt-prefix
    • --statistics

...

Expected behaviour

Shell completion should contain all supported commands and their short/long params, except deprecated or intentionally hidden ones.

Ideas

I found out that this can be generated automatically using:

rebar3 completion -s bash -f ${FILE}

Maybe the shell-completion files can be re-generated automatically before tagging a release?

@ferd
Copy link
Collaborator

ferd commented Oct 1, 2024

That could be an interesting idea for sure. I'm also wondering if it would make sense to run them as a post-hook to escriptize in general?

@fixeria
Copy link
Author

fixeria commented Oct 3, 2024

I'm also wondering if it would make sense to run them as a post-hook to escriptize in general?

Sounds like a good idea to me. It takes less than a second, so why not.

$ time rebar3 completion -s bash -f /dev/null

real    0m0.205s
user    0m0.707s
sys     0m0.215s

Shall I work on a patch? I would be my first time contributing here :)

BTW, the man page manpages/rebar3.1 looks out of date too (last modified 6 years ago).

@ferd
Copy link
Collaborator

ferd commented Oct 3, 2024

Yeah I never remember to run the script there, I think it's just copy/pasting the stuff in manpages/commands into rebar3 shell running in the rebar3 repo.

As for the hooks for the doc, the best option is likely to run it with provider hooks which would only apply it to the current user's shell, but without arguments. If we find ourselves really needing to send all arguments, then maybe expanding the shell hooks will work, even if it's a bit less clean conceptually.

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