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

Fix errors with yadm command file. #976

Merged
merged 20 commits into from
Oct 19, 2024
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1ffd849
feat: add yadm completions to the repo
louiss0 Sep 24, 2024
7d87c83
fix: change completions into file with added fixes
louiss0 Sep 24, 2024
48bd009
feat: Add readme to the new yadm file
louiss0 Sep 24, 2024
7e57d6f
fix: Attempt to format the nu shell file.
louiss0 Sep 24, 2024
08a9b2c
fix: Add if statement to account for second arg not passed in
louiss0 Sep 25, 2024
c6c7a3d
fix: Make all commands with flags passed as args consistent
louiss0 Sep 25, 2024
a9eead0
fix: Forgot the files were moved they must not be in the repo
louiss0 Sep 25, 2024
950706a
Merge branch 'nushell:main' into main
louiss0 Oct 16, 2024
1618cca
Commit latest changes
louiss0 Oct 17, 2024
425e6be
feat: add fetch command
louiss0 Oct 17, 2024
2f7c898
fix: remove all typos
louiss0 Oct 17, 2024
283a7ca
feat: add material for installing yadm and clarify usage
louiss0 Oct 17, 2024
653e121
refactor: write code for fetch command
louiss0 Oct 17, 2024
b4be2ec
Merge branch 'nushell:main' into main
louiss0 Oct 17, 2024
5b2e7fb
fix: apply consistent formatting for the yadm file
louiss0 Oct 17, 2024
6cc13a8
Merge branch 'main' of github.com:louiss0/nu_scripts
louiss0 Oct 17, 2024
852d1a5
fix: replace non-existent value variable with the existent subject va…
louiss0 Oct 17, 2024
dc4dfec
fix: add the proper props to the label property for introspect command
louiss0 Oct 17, 2024
8663b0b
fix: switch out accidentally passed in props with proper values in ge…
louiss0 Oct 18, 2024
2bcf2ab
Merge branch 'main' into main
louiss0 Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 61 additions & 56 deletions modules/yadm/mod.nu
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@


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> {

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
| values
Expand All @@ -20,18 +22,23 @@ def generate_viable_bash_string_flags [

error make {
msg: "Wrong values",
label: $"The values for these flags aren't good please use.
These ($joined_acceptable_bash_types) types.
Bash can't use any of these types at all.
"
label: {
text: $"The values for these flags aren't good please use.
These ($joined_acceptable_bash_types) types.
Bash can't use any of these types at all.
"
span: (metadata $flag_record).span
}

help: $"Please use one of these ($joined_acceptable_bash_types) for each flag"
}

}



$flag_record
| items { |key, value|
| items { |key value|

let value_type = ( $value | describe )

Expand Down Expand Up @@ -66,7 +73,7 @@ export def init [
--w
] {

bash_yadm init (
bash_yadm init ...(
generate_viable_bash_string_flags {
initial-branch:$initial_branch
f:$f
Expand Down Expand Up @@ -122,7 +129,7 @@ def generate_type_flag_completions [] {


export def clone [
url:string
url:string
-f
--no-bootstrap
--bootstrap
Expand Down Expand Up @@ -338,7 +345,7 @@ export def main [
--comment:string
] {

if $key !~ '(?<outer_key>\w+)(?<dot>\.)(?<inner_key>\w+)' {
if string !~ '(?<outer_key>\w+)(?<dot>\.)(?<inner_key>\w+)' {

error make {
msg: 'Invalid Argument',
Expand Down Expand Up @@ -398,7 +405,7 @@ export def main [
}

export def gitconfig [
key:string
key:string
value?:any
--global
--local
Expand Down Expand Up @@ -1072,7 +1079,7 @@ export module show {
export def set-head [
--auto(-a):string
--delete(-d):string
name:string
name:string
] {

bash_yadm remote set-head $name ...(
Expand All @@ -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 ...(
generate_viable_bash_string_flags {
push:$push
Expand Down Expand Up @@ -1191,7 +1198,7 @@ export module show {
checkout:$checkout
lock:$lock
reason:$reason
orphan: $orphan
orphan:$orphan
b:$b

}
Expand All @@ -1206,7 +1213,7 @@ export module show {
checkout:$checkout
lock:$lock
reason:$reason
orphan: $orphan
orphan:$orphan
b:$b
}
)
Expand All @@ -1231,7 +1238,7 @@ export module show {

bash_yadm worktree lock $worktree ...(
generate_viable_bash_string_flags {
reason:reason
reason:$reason
}
)

Expand Down Expand Up @@ -1297,9 +1304,9 @@ export module show {
bash_yadm bisect start $good $bad ...(
generate_viable_bash_string_flags {
term-bad:$term_bad
term-new:term_new
term-good:term_good
term-old:term_old
term-new:$term_new
term-good:$term_good
term-old:$term_old
no-checkout:$no_checkout
first-parent:$first_parent
}
Expand Down Expand Up @@ -1342,9 +1349,9 @@ export module show {
bash_yadm bisect terms ...(
generate_viable_bash_string_flags {
term-bad:$term_bad
term-new:term_new
term-good:term_good
term-old:term_old
term-new:$term_new
term-good:$term_good
term-old:$term_old
}
)

Expand Down Expand Up @@ -1417,13 +1424,13 @@ export module show {
--chmod:string
--pathspec-from-file:string
--pathspec-file-nul
...$pathspecs:string
...pathspecs:string
] {

bash_yadm add ...$pathspecs ...(
generate_viable_bash_string_flags {
verbose:$verbose
dry-run :$dry_run
dry-run:$dry_run
force:$force
interactive:$interactive
patch:$patch
Expand Down Expand Up @@ -1560,8 +1567,8 @@ export def fetch [
--no-tags(-n)
--refmap: string
--tags(-t)
--recurse-submodules: string
--jobs(-j): int
--recurse-submodules:string
--jobs(-j):int
--no-recurse-submodules
--set-upstream
--submodule-prefix: string
Expand All @@ -1580,13 +1587,13 @@ export def fetch [
all:$all
append:$append
atomic:$atomic
depth: int
deepen: int
shallow-since: string
shallow-exclude: string
depth:$depth
deepen:$deepen
shallow-since:$shallow_since
shallow-exclude:$shallow_exclude
unshallow:$unshallow
update-shallow:$update_shallow
negotiation-tip: string
negotiation-tip:$negotiation_tip
negotiate-only:$negotiate_only
dry-run:$dry_run
write-fetch-head:$write_fetch_head
Expand Down Expand Up @@ -1709,8 +1716,6 @@ export def fetch [
allow-empty-message:$allow_empty_message
gpg-sign:$gpg_sign
empty:$empty
allow-empty:allow_empty
allow-empty-message:$allow_empty_message
keep-redundant-commits:$keep_redundant_commits
strategy:$strategy
strategy-option:$strategy_option
Expand Down Expand Up @@ -1780,7 +1785,7 @@ export def fetch [
quiet:$quiet
verbose:$verbose
progress:$progress
server-option:server_option
server-option:$server_option
no-checkout:$no_checkout
reject-shallow:$reject_shallow
no-reject-shallow:$no_reject_shallow
Expand Down Expand Up @@ -1827,19 +1832,19 @@ export module commit {
export def main [
--all(-a)
--patch(-p)
--reuse-message(-c)
--reedit-message(-C)
--fixup
--squash
--reuse-message(-c):string
--reedit-message(-C):string
--fixup:string@get-fixup-completions
--squash:string
--reset-author
--short
--branch
--porcelain
--long
--null(-z)
--file(-F)
--author
--date
--file(-F):string
--author:string
--date:string
--template(-t):string
--signoff
--no-signoff
Expand All @@ -1863,13 +1868,14 @@ export module commit {
--dry-run
--status
--no-status
--gpg-sign
--gpg-sign:string
--no-gpg-sign
--message(-m):string
--message(-m):string
...pathspec:string
] {

bash_yadm commit ...$pathspec ...(
bash_yadm commit ...$pathspec ...(

generate_viable_bash_string_flags {
all:$all
patch:$patch
Expand All @@ -1882,7 +1888,7 @@ export module commit {
branch:$branch
porcelain:$porcelain
long:$long
"null":$null
'null':$null
file:$file
author:$author
date:$date
Expand Down Expand Up @@ -2270,6 +2276,8 @@ export module grep {
}
)

}

}


Expand Down Expand Up @@ -3312,8 +3320,6 @@ export module grep {

}

}

export def reset [
--quiet(-q)
--patch(-p)
Expand Down Expand Up @@ -3486,7 +3492,7 @@ export module grep {
no-commit:$no_commit
edit:$edit
no-edit:$no_edit
cleanup:string
cleanup:$cleanup
ff-only:$ff_only
ff:$ff
no-ff:$no_ff
Expand Down Expand Up @@ -3528,11 +3534,11 @@ export module grep {
prefetch:$prefetch
prune:$prune
no-tags:$no_tags
refmap:string
refmap:$refmap
tags:$tags
jobs:$jobs
set-upstream:$set_upstream
upload-pack:string
upload-pack:$upload_pack
progress:$progress
server-option:$server_option
show-forced-updates:$show_forced_updates
Expand Down Expand Up @@ -3624,12 +3630,12 @@ export module grep {
push-option:$push_option
receive-pack:$receive_pack
exec:$exec
force-with-lease:string
force-with-lease:$force_with_lease
no-force-with-lease:$no_force_with_lease
force:$force
force-if-includes:$force_if_includes
no-force-if-includes:$no_force_if_includes
repo:string
repo:$repo
set-upstream:$set_upstream
thin:$thin
quiet:$quiet
Expand All @@ -3643,7 +3649,6 @@ export module grep {
ipv6:$ipv6
}


match [($repository | describe) ($refspec | describe)] {

[string string] => (bash yadm pull $repository $refspec ...$viable_bash_string_flags)
Expand Down Expand Up @@ -3761,7 +3766,7 @@ export module grep {
strategy-option:$strategy_option
rerere-autoupdate:$rerere_autoupdate
no-rerere-autoupdate:$no_rerere_autoupdate
gpg-sign:string
gpg-sign:$gpg_sign
no-gpg-sign:$no_gpg_sign
quiet:$quiet
verbose:$verbose
Expand Down Expand Up @@ -4025,7 +4030,7 @@ export module restore {
--renames
--no-renames
--find-renames:int
...$pathspecs
...pathspecs
] {

bash_yadm status ...$pathspecs ...(
Expand Down