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

git branch cleanup returns errors. #795

Open
TeaDrinkingProgrammer opened this issue Mar 18, 2024 · 4 comments
Open

git branch cleanup returns errors. #795

TeaDrinkingProgrammer opened this issue Mar 18, 2024 · 4 comments

Comments

@TeaDrinkingProgrammer
Copy link
Contributor

When calling git branch-cleanup, it returns this error:

 × Lists are not automatically spread when calling external commands
    ╭─[C:\Users\Stijn\AppData\Roaming\nushell\scripts\git_branch_cleanup.nu:88:55]
 87 │
 88 │   run-external --redirect-stdout "git" "symbolic-ref" $args
    ·                                                       ──┬──
    ·                                                         ╰── Spread operator (...) is necessary to spread lists
 89 │   | str trim
    ╰────
  help: Either convert the list to a string or use the spread operator, like so: ...$args

I tried adding a spread operator, but that broke the script. Any ideas on how to fix it?

@fdncred
Copy link
Collaborator

fdncred commented Mar 18, 2024

I suspect this is because of 2 reasons

  1. --redirect-stdout and --redirect-stderr have been deprecated
  2. all the rest arguments to custom commands need to use the spread operator, not in just one custom command.

@AucaCoyan
Copy link
Contributor

I suspect this was fixed in #799 , is that correct @TeaDrinkingProgrammer ?

@TeaDrinkingProgrammer
Copy link
Contributor Author

TeaDrinkingProgrammer commented Apr 5, 2024

Some errors have been resolved, but --redirect-stdout is still used, so I get depricated warnings for that and the script also doesn't seem to work anymore:

Error: × Deprecated flag
╭─[C:\Users\Stijn\AppData\Roaming\nushell\scripts\git_branch_cleanup.nu:59:16]
58 │ def current_branch [] {
59 │ run-external --redirect-stdout "git" "branch" "--show-current"
· ────────────────────────┬────────────────────────
· ╰── --redirect-stdout is deprecated
60 │ | into string
╰────
help: run-external will now always redirect stdout if there is a pipe | afterwards

Error: × Deprecated flag
╭─[C:\Users\Stijn\AppData\Roaming\nushell\scripts\git_branch_cleanup.nu:88:16]
87 │
88 │ run-external --redirect-stdout "git" "symbolic-ref" $args
· ──────────────────────┬─────────────────────
· ╰── --redirect-stdout is deprecated
89 │ | str trim
╰────
help: run-external will now always redirect stdout if there is a pipe | afterwards

Error: nu::shell::cannot_pass_list_to_external

× Lists are not automatically spread when calling external commands
╭─[C:\Users\Stijn\AppData\Roaming\nushell\scripts\git_branch_cleanup.nu:88:55]
87 │
88 │ run-external --redirect-stdout "git" "symbolic-ref" $args
· ──┬──
· ╰── Spread operator (...) is necessary to spread lists
89 │ | str trim
╰────
help: Either convert the list to a string or use the spread operator, like so: ...$args

@AucaCoyan
Copy link
Contributor

AucaCoyan commented Apr 5, 2024

The deprecation warning is because the CI is using latest nushell version 0.92, released Apr-02,
here is a link to the deprecated commands chapter in the blogpost

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

3 participants