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

zsh option completions broken in 0.0.8 #360

Closed
kubukoz opened this issue Nov 8, 2021 · 3 comments · Fixed by #423
Closed

zsh option completions broken in 0.0.8 #360

kubukoz opened this issue Nov 8, 2021 · 3 comments · Fixed by #423
Assignees

Comments

@kubukoz
Copy link
Contributor

kubukoz commented Nov 8, 2021

scala-cli run --<tab>, scala-cli compile --<tab> and scala-cli compile -<tab> all result in the following:

…(eval):2: command not found: dev
(eval):2: command not found: release
clang: error: no input files
(eval):2: command not found: .pipe…
(eval):2: command not found: -1

screenshot:

image

This is in zsh on Mac, completions file was generated with scala-cli completions zsh.

@ches
Copy link

ches commented Nov 14, 2021

Bash completion is very broken as well. I can open a separate issue but I imagine the root cause is likely the same.

Result of me simply typing scala-cli <Tab>:

$ scala-cli -bash: --: command not found
sh: _pyenv_virtualenv_hook: command not found
sh: _direnv_hook: command not found
sh: prompt_func: command not found
sh: autojump_add_to_database: command not found
sh-3.2$

What this has done is apparently execute /bin/sh

Also e.g. scala-cli install completions <Tab> executes writing to my ~/.bashrc immediately as though I had hit Enter…

scala-cli --scal<Tab> spews mangled output of scalac -help for --scala-opt:

$ scala-cli --sca
...  -- Set the Scala version
...-bin  -- Set the Scala binary version
...-binary  -- Set the Scala binary version
...-binary-version  -- Set the Scala binary version
...-library
...-opt  -- Add a Usage: scalac <options> <source files>^J^JStandard options:^J  -Dproperty=value             Pass -Dproperty=value directly to the runtime system.^J  -J<flag>                     Pass <flag> directly to the runtime system.^J  -P:<plugin>:<opt>            Pass an option to a plugin^J  -V                           Print a synopsis of verbose options. [false]^J  -W                           Print a synopsis of warning options. [false]^J  -Werror                      Fail the compilation if there are any warnings. [false]^J  -X                           Print a synopsis of advanced options. [false]^J  -Y                           Print a synopsis of private options. [false]^J  -bootclasspath <path>        Override location of bootstrap class files.^J  -classpath <path>            Specify where to find user class files.^J  -d <directory|jar>           destination for generated classfiles.^J  -dependencyfile <file>       Set dependency tracking file.^J  -deprecation                 Emit warning and location for usages of deprecated APIs. See also -Wconf. [false]^J  -encoding <encoding>         Specify character encoding used by source files.^J  -explaintypes                Explain type errors in more detail. [false]^J  -extdirs <path>              Override location of installed extensions.^J  -feature                     Emit warning and location for usages of features that should be imported explicitly. See also -Wconf. [false]^J  -g:<level>                   Set level of generated debugging info. (none,source,line,[vars],notailcalls)^J  -help                        Print a synopsis of standard options [false]^J  -javabootclasspath <path>    Override java boot classpath.^J  -javaextdirs <path>          Override java extdirs classpath.^J  -language:<features>         Enable or disable language features^J  -no-specialization           Ignore @specialize annotations. [false]^J  -nobootcp                    Do not use the boot classpath for the scala jars. [false]^J  -nowarn                      Generate no warnings. [false]^J  -opt:<optimizations>         Enable optimizations, `help` for details.^J  -opt-inline-from:<patterns>  Patterns for classfile names from which to allow inlining, `help` for details.^J  -opt-warnings:<warnings>     Enable optimizer warnings, `help` for details.^J  -print                       Print program with Scala-specific features removed. [false]^J  -release <release>           Compile for a specific version of the Java platform. Supported targets: 6, 7, 8, 9^J  -rootdir <path>              The absolute path of the project root directory, usually the git/scm checkout. Used by -Wconf.^J  -sourcepath <path>           Specify location(s) of source files.^J  -target:<target>             Target platform for object files. ([8],9,10,11,12,13,14,15,16,17,18)^J  -toolcp <path>               Add to the runner classpath.^J  -unchecked                   Enable additional warnings where generated code depends on assumptions. See also -Wconf. [false]^J  -uniqid                      Uniquely tag all identifiers in debugging output. [false]^J  -usejavacp                   Utilize the java.class.path in classpath resolution. [false]^J  -usemanifestcp               Utilize the manifest in classpath resolution. [false]^J  -verbose                     Output messages about what the compiler is doing. [false]^J  -version                     Print product version and exit. [false]^J  @<file>                      A text file containing compiler arguments (options and source files) [false]^J^JDeprecated settings:^J  -optimize                    Enables optimizations. [false]^J                                 deprecated: Since 2.12, enables -opt:l:inline -opt-inline-from:**. See -opt:help. option
...-version  -- Set the Scala version
...c-option  -- Add a Usage: scalac <options> <source files>^J^JStandard options:^J  -Dproperty=value             Pass -Dproperty=value directly to the runtime system.^J  -J<flag>                     Pass <flag> directly to the runtime system.^J  -P:<plugin>:<opt>            Pass an option to a plugin^J  -V                           Print a synopsis of verbose options. [false]^J  -W                           Print a synopsis of warning options. [false]^J  -Werror                      Fail the compilation if there are any warnings. [false]^J  -X                           Print a synopsis of advanced options. [false]^J  -Y                           Print a synopsis of private options. [false]^J  -bootclasspath <path>        Override location of bootstrap class files.^J  -classpath <path>            Specify where to find user class files.^J  -d <directory|jar>           destination for generated classfiles.^J  -dependencyfile <file>       Set dependency tracking file.^J  -deprecation                 Emit warning and location for usages of deprecated APIs. See also -Wconf. [false]^J  -encoding <encoding>         Specify character encoding used by source files.^J  -explaintypes                Explain type errors in more detail. [false]^J  -extdirs <path>              Override location of installed extensions.^J  -feature                     Emit warning and location for usages of features that should be imported explicitly. See also -Wconf. [false]^J  -g:<level>                   Set level of generated debugging info. (none,source,line,[vars],notailcalls)^J  -help                        Print a synopsis of standard options [false]^J  -javabootclasspath <path>    Override java boot classpath.^J  -javaextdirs <path>          Override java extdirs classpath.^J  -language:<features>         Enable or disable language features^J  -no-specialization           Ignore @specialize annotations. [false]^J  -nobootcp                    Do not use the boot classpath for the scala jars. [false]^J  -nowarn                      Generate no warnings. [false]^J  -opt:<optimizations>         Enable optimizations, `help` for details.^J  -opt-inline-from:<patterns>  Patterns for classfile names from which to allow inlining, `help` for details.^J  -opt-warnings:<warnings>     Enable optimizer warnings, `help` for details.^J  -print                       Print program with Scala-specific features removed. [false]^J  -release <release>           Compile for a specific version of the Java platform. Supported targets: 6, 7, 8, 9^J  -rootdir <path>              The absolute path of the project root directory, usually the git/scm checkout. Used by -Wconf.^J  -sourcepath <path>           Specify location(s) of source files.^J  -target:<target>             Target platform for object files. ([8],9,10,11,12,13,14,15,16,17,18)^J  -toolcp <path>               Add to the runner classpath.^J  -unchecked                   Enable additional warnings where generated code depends on assumptions. See also -Wconf. [false]^J  -uniqid                      Uniquely tag all identifiers in debugging output. [false]^J  -usejavacp                   Utilize the java.class.path in classpath resolution. [false]^J  -usemanifestcp               Utilize the manifest in classpath resolution. [false]^J  -verbose                     Output messages about what the compiler is doing. [false]^J  -version                     Print product version and exit. [false]^J  @<file>                      A text file containing compiler arguments (options and source files) [false]^J^JDeprecated settings:^J  -optimize                    Enables optimizations. [false]^J                                 deprecated: Since 2.12, enables -opt:l:inline -opt-inline-from:**. See -opt:help. option

@ches
Copy link

ches commented Nov 14, 2021

I have a feeling the changes like this have resulted in all the backtick-enclosed text in help messages getting interpreted by the shell… improper shell escaping somewhere.

@lwronski lwronski self-assigned this Nov 17, 2021
@lwronski lwronski linked a pull request Nov 29, 2021 that will close this issue
@lwronski
Copy link
Contributor

Thanks for reporting @kubukoz and @ches,

The problem was that the backticks wasn't escaped. It was already fixed and in the next version of scala-cli 0.0.9 competition should work.

I added escaping backticks in bash/zsh completion in case-app. It was done in this PR.

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 a pull request may close this issue.

3 participants