1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Fix errors with yadm command file. (#976)

This is to fix mistakes that are in the yadm module. 
This is necessary for my users. I didn't change any of the files here at
all.
This commit is contained in:
shelton louis 2024-10-18 22:42:31 -04:00 committed by GitHub
parent 04c70789ea
commit fa12d3e905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,10 +3,12 @@
def generate_viable_bash_string_flags [ def generate_viable_bash_string_flags [
flag_record:record # A object filled all known flags and their values. flag_record:record # A object filled all known flags and their values.
] -> list<string> { ] -> list<string> {
const acceptable_bash_types = [string int float duration filesize binary, bool]
const acceptable_bash_types = [string int float duration filesize binary bool]
let not_all_flag_record_values_are_acceptable_bash_types = $flag_record let not_all_flag_record_values_are_acceptable_bash_types = $flag_record
| values | values
@ -20,18 +22,23 @@ def generate_viable_bash_string_flags [
error make { error make {
msg: "Wrong values", msg: "Wrong values",
label: $"The values for these flags aren't good please use. label: {
These ($joined_acceptable_bash_types) types. text: $"The values for these flags aren't good please use.
Bash can't use any of these types at all. These ($joined_acceptable_bash_types) types.
" Bash can't use any of these types at all.
"
span: (metadata $flag_record).span span: (metadata $flag_record).span
}
help: $"Please use one of these ($joined_acceptable_bash_types) for each flag" help: $"Please use one of these ($joined_acceptable_bash_types) for each flag"
} }
} }
$flag_record $flag_record
| items { |key, value| | items { |key value|
let value_type = ( $value | describe ) let value_type = ( $value | describe )
@ -66,7 +73,7 @@ export def init [
--w --w
] { ] {
bash_yadm init ( bash_yadm init ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
initial-branch:$initial_branch initial-branch:$initial_branch
f:$f f:$f
@ -122,7 +129,7 @@ def generate_type_flag_completions [] {
export def clone [ export def clone [
url:string url:string
-f -f
--no-bootstrap --no-bootstrap
--bootstrap --bootstrap
@ -338,7 +345,7 @@ export def main [
--comment:string --comment:string
] { ] {
if $key !~ '(?<outer_key>\w+)(?<dot>\.)(?<inner_key>\w+)' { if string !~ '(?<outer_key>\w+)(?<dot>\.)(?<inner_key>\w+)' {
error make { error make {
msg: 'Invalid Argument', msg: 'Invalid Argument',
@ -398,7 +405,7 @@ export def main [
} }
export def gitconfig [ export def gitconfig [
key:string key:string
value?:any value?:any
--global --global
--local --local
@ -1072,7 +1079,7 @@ export module show {
export def set-head [ export def set-head [
--auto(-a):string --auto(-a):string
--delete(-d):string --delete(-d):string
name:string name:string
] { ] {
bash_yadm remote set-head $name ...( bash_yadm remote set-head $name ...(
@ -1094,8 +1101,8 @@ export module show {
} }
export def get-url [--all --push, name:string] { export def get-url [--all --push,name:string] {
bash_yadm remote get-url $name ...( bash_yadm remote get-url $name ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
push:$push push:$push
@ -1191,7 +1198,7 @@ export module show {
checkout:$checkout checkout:$checkout
lock:$lock lock:$lock
reason:$reason reason:$reason
orphan: $orphan orphan:$orphan
b:$b b:$b
} }
@ -1206,7 +1213,7 @@ export module show {
checkout:$checkout checkout:$checkout
lock:$lock lock:$lock
reason:$reason reason:$reason
orphan: $orphan orphan:$orphan
b:$b b:$b
} }
) )
@ -1231,7 +1238,7 @@ export module show {
bash_yadm worktree lock $worktree ...( bash_yadm worktree lock $worktree ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
reason:reason reason:$reason
} }
) )
@ -1297,9 +1304,9 @@ export module show {
bash_yadm bisect start $good $bad ...( bash_yadm bisect start $good $bad ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
term-bad:$term_bad term-bad:$term_bad
term-new:term_new term-new:$term_new
term-good:term_good term-good:$term_good
term-old:term_old term-old:$term_old
no-checkout:$no_checkout no-checkout:$no_checkout
first-parent:$first_parent first-parent:$first_parent
} }
@ -1342,9 +1349,9 @@ export module show {
bash_yadm bisect terms ...( bash_yadm bisect terms ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
term-bad:$term_bad term-bad:$term_bad
term-new:term_new term-new:$term_new
term-good:term_good term-good:$term_good
term-old:term_old term-old:$term_old
} }
) )
@ -1417,13 +1424,13 @@ export module show {
--chmod:string --chmod:string
--pathspec-from-file:string --pathspec-from-file:string
--pathspec-file-nul --pathspec-file-nul
...$pathspecs:string ...pathspecs:string
] { ] {
bash_yadm add ...$pathspecs ...( bash_yadm add ...$pathspecs ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
verbose:$verbose verbose:$verbose
dry-run :$dry_run dry-run:$dry_run
force:$force force:$force
interactive:$interactive interactive:$interactive
patch:$patch patch:$patch
@ -1560,8 +1567,8 @@ export def fetch [
--no-tags(-n) --no-tags(-n)
--refmap: string --refmap: string
--tags(-t) --tags(-t)
--recurse-submodules: string --recurse-submodules:string
--jobs(-j): int --jobs(-j):int
--no-recurse-submodules --no-recurse-submodules
--set-upstream --set-upstream
--submodule-prefix: string --submodule-prefix: string
@ -1580,13 +1587,13 @@ export def fetch [
all:$all all:$all
append:$append append:$append
atomic:$atomic atomic:$atomic
depth: int depth:$depth
deepen: int deepen:$deepen
shallow-since: string shallow-since:$shallow_since
shallow-exclude: string shallow-exclude:$shallow_exclude
unshallow:$unshallow unshallow:$unshallow
update-shallow:$update_shallow update-shallow:$update_shallow
negotiation-tip: string negotiation-tip:$negotiation_tip
negotiate-only:$negotiate_only negotiate-only:$negotiate_only
dry-run:$dry_run dry-run:$dry_run
write-fetch-head:$write_fetch_head write-fetch-head:$write_fetch_head
@ -1709,8 +1716,6 @@ export def fetch [
allow-empty-message:$allow_empty_message allow-empty-message:$allow_empty_message
gpg-sign:$gpg_sign gpg-sign:$gpg_sign
empty:$empty empty:$empty
allow-empty:allow_empty
allow-empty-message:$allow_empty_message
keep-redundant-commits:$keep_redundant_commits keep-redundant-commits:$keep_redundant_commits
strategy:$strategy strategy:$strategy
strategy-option:$strategy_option strategy-option:$strategy_option
@ -1780,7 +1785,7 @@ export def fetch [
quiet:$quiet quiet:$quiet
verbose:$verbose verbose:$verbose
progress:$progress progress:$progress
server-option:server_option server-option:$server_option
no-checkout:$no_checkout no-checkout:$no_checkout
reject-shallow:$reject_shallow reject-shallow:$reject_shallow
no-reject-shallow:$no_reject_shallow no-reject-shallow:$no_reject_shallow
@ -1827,19 +1832,19 @@ export module commit {
export def main [ export def main [
--all(-a) --all(-a)
--patch(-p) --patch(-p)
--reuse-message(-c) --reuse-message(-c):string
--reedit-message(-C) --reedit-message(-C):string
--fixup --fixup:string@get-fixup-completions
--squash --squash:string
--reset-author --reset-author
--short --short
--branch --branch
--porcelain --porcelain
--long --long
--null(-z) --null(-z)
--file(-F) --file(-F):string
--author --author:string
--date --date:string
--template(-t):string --template(-t):string
--signoff --signoff
--no-signoff --no-signoff
@ -1863,13 +1868,14 @@ export module commit {
--dry-run --dry-run
--status --status
--no-status --no-status
--gpg-sign --gpg-sign:string
--no-gpg-sign --no-gpg-sign
--message(-m):string --message(-m):string
...pathspec:string ...pathspec:string
] { ] {
bash_yadm commit ...$pathspec ...( bash_yadm commit ...$pathspec ...(
generate_viable_bash_string_flags { generate_viable_bash_string_flags {
all:$all all:$all
patch:$patch patch:$patch
@ -1882,7 +1888,7 @@ export module commit {
branch:$branch branch:$branch
porcelain:$porcelain porcelain:$porcelain
long:$long long:$long
"null":$null 'null':$null
file:$file file:$file
author:$author author:$author
date:$date date:$date
@ -2270,6 +2276,8 @@ export module grep {
} }
) )
}
} }
@ -3312,8 +3320,6 @@ export module grep {
} }
}
export def reset [ export def reset [
--quiet(-q) --quiet(-q)
--patch(-p) --patch(-p)
@ -3486,7 +3492,7 @@ export module grep {
no-commit:$no_commit no-commit:$no_commit
edit:$edit edit:$edit
no-edit:$no_edit no-edit:$no_edit
cleanup:string cleanup:$cleanup
ff-only:$ff_only ff-only:$ff_only
ff:$ff ff:$ff
no-ff:$no_ff no-ff:$no_ff
@ -3528,11 +3534,11 @@ export module grep {
prefetch:$prefetch prefetch:$prefetch
prune:$prune prune:$prune
no-tags:$no_tags no-tags:$no_tags
refmap:string refmap:$refmap
tags:$tags tags:$tags
jobs:$jobs jobs:$jobs
set-upstream:$set_upstream set-upstream:$set_upstream
upload-pack:string upload-pack:$upload_pack
progress:$progress progress:$progress
server-option:$server_option server-option:$server_option
show-forced-updates:$show_forced_updates show-forced-updates:$show_forced_updates
@ -3624,12 +3630,12 @@ export module grep {
push-option:$push_option push-option:$push_option
receive-pack:$receive_pack receive-pack:$receive_pack
exec:$exec exec:$exec
force-with-lease:string force-with-lease:$force_with_lease
no-force-with-lease:$no_force_with_lease no-force-with-lease:$no_force_with_lease
force:$force force:$force
force-if-includes:$force_if_includes force-if-includes:$force_if_includes
no-force-if-includes:$no_force_if_includes no-force-if-includes:$no_force_if_includes
repo:string repo:$repo
set-upstream:$set_upstream set-upstream:$set_upstream
thin:$thin thin:$thin
quiet:$quiet quiet:$quiet
@ -3643,7 +3649,6 @@ export module grep {
ipv6:$ipv6 ipv6:$ipv6
} }
match [($repository | describe) ($refspec | describe)] { match [($repository | describe) ($refspec | describe)] {
[string string] => (bash yadm pull $repository $refspec ...$viable_bash_string_flags) [string string] => (bash yadm pull $repository $refspec ...$viable_bash_string_flags)
@ -3761,7 +3766,7 @@ export module grep {
strategy-option:$strategy_option strategy-option:$strategy_option
rerere-autoupdate:$rerere_autoupdate rerere-autoupdate:$rerere_autoupdate
no-rerere-autoupdate:$no_rerere_autoupdate no-rerere-autoupdate:$no_rerere_autoupdate
gpg-sign:string gpg-sign:$gpg_sign
no-gpg-sign:$no_gpg_sign no-gpg-sign:$no_gpg_sign
quiet:$quiet quiet:$quiet
verbose:$verbose verbose:$verbose
@ -4025,7 +4030,7 @@ export module restore {
--renames --renames
--no-renames --no-renames
--find-renames:int --find-renames:int
...$pathspecs ...pathspecs
] { ] {
bash_yadm status ...$pathspecs ...( bash_yadm status ...$pathspecs ...(