mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
fix conflicts between git-completions.nu and git-aliases.nu (#651)
This PR fixes the conflicts between git-completions.nu and git-aliases.nu. Prior to this PR you would see problems like this ```nushell ❯ use custom-completions\git\git-completions.nu * ❯ use aliases\git\git-aliases.nu Error: nu::parser::missing_flag_param × Missing flag argument. ╭─[D:\nu_scripts\aliases\git\git-aliases.nu:64:1] 64 │ export alias gco = git checkout 65 │ export alias gcor = git checkout --recurse-submodules · ──────────┬───────── · ╰── flag missing string argument 66 │ export alias gcount = git shortlog --summary --numbered ╰──── ``` This is because, in this example, in git-completions.nu, there is a custom command named `git checkout` that takes a `--recurse-submodules: string` parameter, which means it's expecting a string. Removing the `: string` part fixes the issue and allows the files to be sourced/used as expected. This seems more like a hack than a fix. I'm not sure if this behavior is intended or not, but this PR fixes it anyway. close #493
This commit is contained in:
parent
14459f923b
commit
310b1df564
1 changed files with 8 additions and 8 deletions
|
@ -100,10 +100,10 @@ const short_status_descriptions = {
|
||||||
|
|
||||||
def "nu-complete git files" [] {
|
def "nu-complete git files" [] {
|
||||||
let relevant_statuses = ["??"," M", "MM", "MD", " D"]
|
let relevant_statuses = ["??"," M", "MM", "MD", " D"]
|
||||||
^git status --porcelain
|
^git status --porcelain
|
||||||
| lines
|
| lines
|
||||||
| parse --regex "(?P<short_status>.{2}) (?P<value>.+)"
|
| parse --regex "(?P<short_status>.{2}) (?P<value>.+)"
|
||||||
| where $it.short_status in $relevant_statuses
|
| where $it.short_status in $relevant_statuses
|
||||||
| insert "description" { |e| $short_status_descriptions | get $e.short_status}
|
| insert "description" { |e| $short_status_descriptions | get $e.short_status}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,10 +154,10 @@ export extern "git checkout" [
|
||||||
--pathspec-from-file: string # read pathspec from file
|
--pathspec-from-file: string # read pathspec from file
|
||||||
--progress # force progress reporting
|
--progress # force progress reporting
|
||||||
--quiet(-q) # suppress progress reporting
|
--quiet(-q) # suppress progress reporting
|
||||||
--recurse-submodules: string # control recursive updating of submodules
|
--recurse-submodules # control recursive updating of submodules
|
||||||
--theirs(-3) # checkout their version for unmerged files
|
--theirs(-3) # checkout their version for unmerged files
|
||||||
--track(-t) # set upstream info for new branch
|
--track(-t) # set upstream info for new branch
|
||||||
-b: string # create and checkout a new branch
|
-b # create and checkout a new branch
|
||||||
-B: string # create/reset and checkout a branch
|
-B: string # create/reset and checkout a branch
|
||||||
-l # create reflog for new branch
|
-l # create reflog for new branch
|
||||||
]
|
]
|
||||||
|
@ -251,7 +251,7 @@ export extern "git pull" [
|
||||||
# Switch between branches and commits
|
# Switch between branches and commits
|
||||||
export extern "git switch" [
|
export extern "git switch" [
|
||||||
switch?: string@"nu-complete git switch" # name of branch to switch to
|
switch?: string@"nu-complete git switch" # name of branch to switch to
|
||||||
--create(-c): string # create a new branch
|
--create(-c) # create a new branch
|
||||||
--detach(-d): string@"nu-complete git log" # switch to a commit in a detatched state
|
--detach(-d): string@"nu-complete git log" # switch to a commit in a detatched state
|
||||||
--force-create(-C): string # forces creation of new branch, if it exists then the existing branch will be reset to starting point
|
--force-create(-C): string # forces creation of new branch, if it exists then the existing branch will be reset to starting point
|
||||||
--force(-f) # alias for --discard-changes
|
--force(-f) # alias for --discard-changes
|
||||||
|
@ -363,7 +363,7 @@ export extern "git diff" [
|
||||||
export extern "git commit" [
|
export extern "git commit" [
|
||||||
--all(-a) # automatically stage all modified and deleted files
|
--all(-a) # automatically stage all modified and deleted files
|
||||||
--amend # amend the previous commit rather than adding a new one
|
--amend # amend the previous commit rather than adding a new one
|
||||||
--message(-m): string # specify the commit message rather than opening an editor
|
--message(-m) # specify the commit message rather than opening an editor
|
||||||
--no-edit # don't edit the commit message (useful with --amend)
|
--no-edit # don't edit the commit message (useful with --amend)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue