From ea1991c68e220688c58954bc1128c9138dad8008 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:32:23 +0100 Subject: [PATCH 01/10] rename `package.nuon` to `nupm.nuon` (#141) related to - https://github.com/nushell/nupm/pull/51 ## description this PR renames the `package.nuon` files to `nupm.nuon` as per https://github.com/nushell/nupm/pull/51. --- pkgs/nu-git-manager-sugar/{package.nuon => nupm.nuon} | 0 pkgs/nu-git-manager/{package.nuon => nupm.nuon} | 0 toolkit.nu | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/nu-git-manager-sugar/{package.nuon => nupm.nuon} (100%) rename pkgs/nu-git-manager/{package.nuon => nupm.nuon} (100%) diff --git a/pkgs/nu-git-manager-sugar/package.nuon b/pkgs/nu-git-manager-sugar/nupm.nuon similarity index 100% rename from pkgs/nu-git-manager-sugar/package.nuon rename to pkgs/nu-git-manager-sugar/nupm.nuon diff --git a/pkgs/nu-git-manager/package.nuon b/pkgs/nu-git-manager/nupm.nuon similarity index 100% rename from pkgs/nu-git-manager/package.nuon rename to pkgs/nu-git-manager/nupm.nuon diff --git a/toolkit.nu b/toolkit.nu index 7ec398d..906512b 100644 --- a/toolkit.nu +++ b/toolkit.nu @@ -2,7 +2,7 @@ use std repeat # NOTE: this will likely get replaced by Nupm workspaces in the future def list-modules-of-workspace []: nothing -> list { - ls pkgs/**/package.nuon + ls pkgs/**/nupm.nuon | insert pkg {|it| open $it.name | get name } | each {|it| $it.name | path dirname | path join $it.pkg } } From f359ced50eb4798e1e74b3fcfc769fceb91d6236 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:41:24 +0100 Subject: [PATCH 02/10] fix the export of modules (#134) depends on - https://github.com/nushell/nushell/pull/11157 - https://github.com/nushell/nupm/pull/47 - https://github.com/amtoine/nu-git-manager/pull/140 - https://github.com/amtoine/nu-git-manager/pull/141 ## description as directory modules won't export the modules next to any `mod.nu`, this PR adds `export module` calls to `nu-git-manager-sugar` and the tests, making the source base compatible again with https://github.com/nushell/nushell/pull/11157 and https://github.com/nushell/nupm/pull/47. --- pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu | 2 ++ pkgs/nu-git-manager-sugar/tests/mod.nu | 2 ++ pkgs/nu-git-manager/tests/mod.nu | 2 ++ src/nu-git-manager-sugar/mod.nu | 3 +++ 4 files changed, 9 insertions(+) create mode 100644 src/nu-git-manager-sugar/mod.nu diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu index 9d6dfa1..1383184 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu @@ -6,6 +6,8 @@ use ../completions/nu-complete.nu [ GIT_QUERY_TABLES, GIT_STRATEGIES, git-query-tables, get-remotes, get-branches, get-strategies ] +export module prompt.nu + # get the commit hash of any revision # # ## Examples diff --git a/pkgs/nu-git-manager-sugar/tests/mod.nu b/pkgs/nu-git-manager-sugar/tests/mod.nu index 188dfe7..cfe8a2d 100644 --- a/pkgs/nu-git-manager-sugar/tests/mod.nu +++ b/pkgs/nu-git-manager-sugar/tests/mod.nu @@ -3,6 +3,8 @@ use std assert use ../../../tests/common/import.nu ["assert imports"] use ../../../tests/common/setup.nu [get-random-test-dir] +export module git.nu + const MODULE = "nu-git-manager-sugar" export module imports { diff --git a/pkgs/nu-git-manager/tests/mod.nu b/pkgs/nu-git-manager/tests/mod.nu index e9f1f63..2081a46 100644 --- a/pkgs/nu-git-manager/tests/mod.nu +++ b/pkgs/nu-git-manager/tests/mod.nu @@ -20,6 +20,8 @@ use ../../../pkgs/nu-git-manager/nu-git-manager/fs/dir.nu [clean-empty-directori use ../../../tests/common/setup.nu [get-random-test-dir] +export module gm.nu + export module path { export def sanitization [] { assert equal ('\foo\bar' | path sanitize) "/foo/bar" diff --git a/src/nu-git-manager-sugar/mod.nu b/src/nu-git-manager-sugar/mod.nu new file mode 100644 index 0000000..f40089d --- /dev/null +++ b/src/nu-git-manager-sugar/mod.nu @@ -0,0 +1,3 @@ +export module extra.nu +export module git +export module github.nu From 123ee54f8431a8eeed54250ca7e9b3ea7d875ca4 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Sat, 16 Dec 2023 13:47:41 +0100 Subject: [PATCH 03/10] fix module exports (#147) follow-up to - https://github.com/amtoine/nu-git-manager/pull/134 ## description - `toolkit.nu` still contained `./src/` - there was a bad `./src/nu-git-manager/mod.nu` introduced by https://github.com/amtoine/nu-git-manager/pull/134 --- pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu | 3 +++ src/nu-git-manager-sugar/mod.nu | 3 --- toolkit.nu | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 src/nu-git-manager-sugar/mod.nu diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu index e69de29..f40089d 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu @@ -0,0 +1,3 @@ +export module extra.nu +export module git +export module github.nu diff --git a/src/nu-git-manager-sugar/mod.nu b/src/nu-git-manager-sugar/mod.nu deleted file mode 100644 index f40089d..0000000 --- a/src/nu-git-manager-sugar/mod.nu +++ /dev/null @@ -1,3 +0,0 @@ -export module extra.nu -export module git -export module github.nu diff --git a/toolkit.nu b/toolkit.nu index 906512b..fcb2dc6 100644 --- a/toolkit.nu +++ b/toolkit.nu @@ -114,11 +114,13 @@ export def "run" [ } let sugar_imports = if $sugar != null { - $sugar | each { $"use ./src/nu-git-manager-sugar ($in) *" } + $sugar | each { $"use ./pkgs/nu-git-manager-sugar/nu-git-manager-sugar ($in) *" } } else { [] } - let imports = $sugar_imports | prepend "use ./src/nu-git-manager *" | str join "\n" + let imports = $sugar_imports + | prepend "use ./pkgs/nu-git-manager/nu-git-manager *" + | str join "\n" let nu_args = [ --env-config $env_file From f233e49e9539cccdf11a7c384dc7d6f8147ac995 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Mon, 18 Dec 2023 12:43:22 +0100 Subject: [PATCH 04/10] refactor internal modules (#149) should - close #85 ## description ### before ``` pkgs/nu-git-manager/ |-- nu-git-manager | |-- completions | | `-- nu-complete.nu | |-- error | | `-- error.nu | |-- fs | | |-- cache.nu | | |-- dir.nu | | |-- path.nu | | `-- store.nu | |-- git | | |-- repo.nu | | `-- url.nu | `-- mod.nu |-- nupm.nuon `-- tests |-- gm.nu `-- mod.nu ``` ``` pkgs/nu-git-manager-sugar/ |-- nu-git-manager-sugar | |-- completions | | `-- nu-complete.nu | |-- extra.nu | |-- git | | |-- lib | | | |-- lib.nu | | | |-- prompt.nu | | | `-- style.nu | | |-- mod.nu | | `-- prompt.nu | |-- github.nu | `-- mod.nu |-- nupm.nuon `-- tests |-- git.nu `-- mod.nu ``` ### after > **Important** > caveats: > - `[1]`: has `use path.nu ...` instead of `use path` > - `[2]`: has `use style.nu ...` instead of `use style` ``` pkgs/nu-git-manager/ |-- nu-git-manager | |-- completions.nu # internal | |-- error.nu # internal | |-- fs # internal | | |-- cache.nu [1] | | |-- dir.nu [1] | | |-- mod.nu | | |-- path.nu | | `-- store.nu [1] | |-- git # internal | | |-- mod.nu | | |-- repo.nu | | `-- url.nu | `-- mod.nu |-- nupm.nuon `-- tests |-- gm.nu `-- mod.nu ``` ``` pkgs/nu-git-manager-sugar/ |-- nu-git-manager-sugar | |-- completions.nu # internal | |-- extra.nu # public | |-- git # public | | |-- lib # internal | | | |-- git.nu [2]# public | | | |-- mod.nu | | | |-- prompt.nu # public | | | `-- style.nu [2]# public | | |-- mod.nu | | `-- prompt.nu # public | |-- github.nu # public | `-- mod.nu |-- nupm.nuon `-- tests |-- git.nu `-- mod.nu ``` ## TODO - [x] `nu-git-manager-sugar/git/lib` issue with `prompt.nu` in https://github.com/amtoine/nu-git-manager/pull/149/commits/77596ff1fb62c6866ab7b24a594b98f67ebd1f4b --- .../nu-complete.nu => completions.nu} | 0 .../git/lib/{lib.nu => git.nu} | 3 ++- .../nu-git-manager-sugar/git/lib/mod.nu | 3 +++ .../nu-git-manager-sugar/git/lib/prompt.nu | 4 +-- .../nu-git-manager-sugar/git/mod.nu | 5 ++-- .../nu-git-manager-sugar/git/prompt.nu | 2 +- .../nu-git-manager-sugar/mod.nu | 3 ++- pkgs/nu-git-manager-sugar/tests/git.nu | 8 +++--- .../nu-complete.nu => completions.nu} | 0 .../nu-git-manager/{error => }/error.nu | 0 .../nu-git-manager/nu-git-manager/fs/cache.nu | 1 - pkgs/nu-git-manager/nu-git-manager/fs/mod.nu | 4 +++ pkgs/nu-git-manager/nu-git-manager/git/mod.nu | 2 ++ .../nu-git-manager/nu-git-manager/git/repo.nu | 2 +- pkgs/nu-git-manager/nu-git-manager/git/url.nu | 2 +- pkgs/nu-git-manager/nu-git-manager/mod.nu | 25 +++++++++++-------- pkgs/nu-git-manager/tests/gm.nu | 4 +-- pkgs/nu-git-manager/tests/mod.nu | 12 ++++----- tests/common/setup.nu | 2 +- 19 files changed, 49 insertions(+), 33 deletions(-) rename pkgs/nu-git-manager-sugar/nu-git-manager-sugar/{completions/nu-complete.nu => completions.nu} (100%) rename pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/{lib.nu => git.nu} (99%) create mode 100644 pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/mod.nu rename pkgs/nu-git-manager/nu-git-manager/{completions/nu-complete.nu => completions.nu} (100%) rename pkgs/nu-git-manager/nu-git-manager/{error => }/error.nu (100%) create mode 100644 pkgs/nu-git-manager/nu-git-manager/fs/mod.nu create mode 100644 pkgs/nu-git-manager/nu-git-manager/git/mod.nu diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/completions/nu-complete.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/completions.nu similarity index 100% rename from pkgs/nu-git-manager-sugar/nu-git-manager-sugar/completions/nu-complete.nu rename to pkgs/nu-git-manager-sugar/nu-git-manager-sugar/completions.nu diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/lib.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu similarity index 99% rename from pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/lib.nu rename to pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu index a092f1d..d5ddf8a 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/lib.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu @@ -1,4 +1,4 @@ -use ../../git/lib/style.nu [color] +use style.nu [color] # give the revision of the repo you're in # @@ -119,3 +119,4 @@ export def get-status [ untracked: ($status | parse --regex '^\?\? (?.*)' | get file), } } + diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/mod.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/mod.nu new file mode 100644 index 0000000..6a62b94 --- /dev/null +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/mod.nu @@ -0,0 +1,3 @@ +export module git.nu +export module prompt.nu +export module style.nu diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu index e9349ba..6fa21fd 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu @@ -1,5 +1,5 @@ -use ../../git/lib/lib.nu [get-revision, git-action, get-status] -use ../../git/lib/style.nu [color, simplify-path] +use git [get-revision, git-action, get-status] +use style.nu [color, simplify-path] # /!\ the PWD will be sanitized export def get-left-prompt [duration_threshold: duration]: nothing -> string { diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu index 1383184..3ba82e6 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu @@ -1,8 +1,9 @@ use std log -use ../git/lib/lib.nu [get-status] +module lib/ +use lib git [get-status] -use ../completions/nu-complete.nu [ +use completions [ GIT_QUERY_TABLES, GIT_STRATEGIES, git-query-tables, get-remotes, get-branches, get-strategies ] diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/prompt.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/prompt.nu index 2b7bb02..22248f5 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/prompt.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/prompt.nu @@ -1,4 +1,4 @@ -use ../git/lib/prompt.nu [get-left-prompt] +use lib prompt [get-left-prompt] const DEFAULT_PROMPT_INDICATORS = { plain: "> ", diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu index f40089d..bdb3897 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/mod.nu @@ -1,3 +1,4 @@ +module completions.nu export module extra.nu -export module git +export module git/ export module github.nu diff --git a/pkgs/nu-git-manager-sugar/tests/git.nu b/pkgs/nu-git-manager-sugar/tests/git.nu index af15a2e..9e67eca 100644 --- a/pkgs/nu-git-manager-sugar/tests/git.nu +++ b/pkgs/nu-git-manager-sugar/tests/git.nu @@ -11,7 +11,7 @@ use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/ git [ "gm repo branch wipe" "gm repo compare" ] -use ../../../pkgs/nu-git-manager/nu-git-manager/fs/path.nu ["path sanitize"] +use ../../../pkgs/nu-git-manager/nu-git-manager/fs path ["path sanitize"] use ../../../tests/common/setup.nu [get-random-test-dir] def --env init-repo-and-cd-into []: nothing -> path { @@ -369,13 +369,13 @@ export def branch-compare [] { } export module prompt { - use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/lib.nu [ + use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib git [ get-revision, git-action ] - use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu [ + use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib prompt [ get-left-prompt ] - use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/style.nu [ + use ../../../pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib style [ simplify-path ] diff --git a/pkgs/nu-git-manager/nu-git-manager/completions/nu-complete.nu b/pkgs/nu-git-manager/nu-git-manager/completions.nu similarity index 100% rename from pkgs/nu-git-manager/nu-git-manager/completions/nu-complete.nu rename to pkgs/nu-git-manager/nu-git-manager/completions.nu diff --git a/pkgs/nu-git-manager/nu-git-manager/error/error.nu b/pkgs/nu-git-manager/nu-git-manager/error.nu similarity index 100% rename from pkgs/nu-git-manager/nu-git-manager/error/error.nu rename to pkgs/nu-git-manager/nu-git-manager/error.nu diff --git a/pkgs/nu-git-manager/nu-git-manager/fs/cache.nu b/pkgs/nu-git-manager/nu-git-manager/fs/cache.nu index 02f2079..264fa63 100644 --- a/pkgs/nu-git-manager/nu-git-manager/fs/cache.nu +++ b/pkgs/nu-git-manager/nu-git-manager/fs/cache.nu @@ -1,5 +1,4 @@ use path.nu "path sanitize" -use ../git/repo.nu [is-grafted] # get the path to the cache of the local store of repos # diff --git a/pkgs/nu-git-manager/nu-git-manager/fs/mod.nu b/pkgs/nu-git-manager/nu-git-manager/fs/mod.nu new file mode 100644 index 0000000..d221af7 --- /dev/null +++ b/pkgs/nu-git-manager/nu-git-manager/fs/mod.nu @@ -0,0 +1,4 @@ +export module cache.nu +export module dir.nu +export module path.nu +export module store.nu diff --git a/pkgs/nu-git-manager/nu-git-manager/git/mod.nu b/pkgs/nu-git-manager/nu-git-manager/git/mod.nu new file mode 100644 index 0000000..6247e39 --- /dev/null +++ b/pkgs/nu-git-manager/nu-git-manager/git/mod.nu @@ -0,0 +1,2 @@ +export module repo.nu +export module url.nu diff --git a/pkgs/nu-git-manager/nu-git-manager/git/repo.nu b/pkgs/nu-git-manager/nu-git-manager/git/repo.nu index 5d3995d..dc07eea 100644 --- a/pkgs/nu-git-manager/nu-git-manager/git/repo.nu +++ b/pkgs/nu-git-manager/nu-git-manager/git/repo.nu @@ -1,4 +1,4 @@ -use ../error/error.nu [throw-error] +use ../error.nu [throw-error] # tell if a local repository has been grafted # diff --git a/pkgs/nu-git-manager/nu-git-manager/git/url.nu b/pkgs/nu-git-manager/nu-git-manager/git/url.nu index 714144d..8744270 100644 --- a/pkgs/nu-git-manager/nu-git-manager/git/url.nu +++ b/pkgs/nu-git-manager/nu-git-manager/git/url.nu @@ -1,4 +1,4 @@ -use ../fs/path.nu "path sanitize" +use ../fs path "path sanitize" # parse the URL of a Git repo # diff --git a/pkgs/nu-git-manager/nu-git-manager/mod.nu b/pkgs/nu-git-manager/nu-git-manager/mod.nu index 3c00f71..1699a18 100644 --- a/pkgs/nu-git-manager/nu-git-manager/mod.nu +++ b/pkgs/nu-git-manager/nu-git-manager/mod.nu @@ -1,17 +1,22 @@ use std log -use fs/store.nu [get-repo-store-path, list-repos-in-store] -use fs/cache.nu [ +module completions.nu +module error.nu +module fs/ +module git/ + +use fs store [get-repo-store-path, list-repos-in-store] +use fs cache [ get-repo-store-cache-path, check-cache-file, add-to-cache, remove-from-cache, open-cache, save-cache, clean-cache-dir ] -use fs/dir.nu [clean-empty-directories-rec] -use fs/path.nu ["path sanitize", "path remove-prefix"] -use git/url.nu [parse-git-url, get-fetch-push-urls] -use git/repo.nu [is-grafted, get-root-commit, list-remotes] -use error/error.nu [throw-error, throw-warning] +use fs dir [clean-empty-directories-rec] +use fs path ["path sanitize", "path remove-prefix"] +use git url [parse-git-url, get-fetch-push-urls] +use git repo [is-grafted, get-root-commit, list-remotes] +use error.nu [throw-error, throw-warning] -use completions/nu-complete.nu +use completions # manage your Git repositories with the main command of NGM # @@ -84,8 +89,8 @@ export def "gm clone" [ url: string # the URL to the repository to clone, supports HTTPS and SSH links, as well as references ending in `.git` or starting with `git@` --remote: string = "origin" # the name of the remote to setup --ssh # setup the remote to use the SSH protocol both to FETCH and to PUSH - --fetch: string@"nu-complete git-protocols" # setup the FETCH protocol explicitely, will overwrite `--ssh` for FETCH - --push: string@"nu-complete git-protocols" # setup the PUSH protocol explicitely, will overwrite `--ssh` for PUSH + --fetch: string@"completions git-protocols" # setup the FETCH protocol explicitely, will overwrite `--ssh` for FETCH + --push: string@"completions git-protocols" # setup the PUSH protocol explicitely, will overwrite `--ssh` for PUSH --bare # clone the repository as a "bare" project --depth: int # the depth at which to clone the repository ]: nothing -> nothing { diff --git a/pkgs/nu-git-manager/tests/gm.nu b/pkgs/nu-git-manager/tests/gm.nu index ceb9f97..d27b012 100644 --- a/pkgs/nu-git-manager/tests/gm.nu +++ b/pkgs/nu-git-manager/tests/gm.nu @@ -1,7 +1,7 @@ use std assert -use ../../../pkgs/nu-git-manager/nu-git-manager/fs/path.nu ["path sanitize"] -use ../../../pkgs/nu-git-manager/nu-git-manager/git/repo.nu [list-remotes] +use ../../../pkgs/nu-git-manager/nu-git-manager/fs path ["path sanitize"] +use ../../../pkgs/nu-git-manager/nu-git-manager/git repo [list-remotes] use ../../../pkgs/nu-git-manager/nu-git-manager/ * use ../../../tests/common/setup.nu [get-random-test-dir] diff --git a/pkgs/nu-git-manager/tests/mod.nu b/pkgs/nu-git-manager/tests/mod.nu index 2081a46..212b992 100644 --- a/pkgs/nu-git-manager/tests/mod.nu +++ b/pkgs/nu-git-manager/tests/mod.nu @@ -1,22 +1,22 @@ use std assert -use ../../../pkgs/nu-git-manager/nu-git-manager/git/url.nu [ +use ../../../pkgs/nu-git-manager/nu-git-manager/git url [ parse-git-url, get-fetch-push-urls ] -use ../../../pkgs/nu-git-manager/nu-git-manager/git/repo.nu [ +use ../../../pkgs/nu-git-manager/nu-git-manager/git repo [ is-grafted, get-root-commit, list-remotes ] -use ../../../pkgs/nu-git-manager/nu-git-manager/fs/store.nu [ +use ../../../pkgs/nu-git-manager/nu-git-manager/fs store [ get-repo-store-path, list-repos-in-store ] -use ../../../pkgs/nu-git-manager/nu-git-manager/fs/cache.nu [ +use ../../../pkgs/nu-git-manager/nu-git-manager/fs cache [ get-repo-store-cache-path, check-cache-file, add-to-cache, remove-from-cache, open-cache, save-cache, clean-cache-dir ] -use ../../../pkgs/nu-git-manager/nu-git-manager/fs/path.nu [ +use ../../../pkgs/nu-git-manager/nu-git-manager/fs path [ "path sanitize", "path remove-prefix", "path remove-trailing-path-sep" ] -use ../../../pkgs/nu-git-manager/nu-git-manager/fs/dir.nu [clean-empty-directories-rec] +use ../../../pkgs/nu-git-manager/nu-git-manager/fs dir [clean-empty-directories-rec] use ../../../tests/common/setup.nu [get-random-test-dir] diff --git a/tests/common/setup.nu b/tests/common/setup.nu index 476e258..ae2f4d4 100644 --- a/tests/common/setup.nu +++ b/tests/common/setup.nu @@ -1,4 +1,4 @@ -use ../../pkgs/nu-git-manager/nu-git-manager/fs/path.nu ["path sanitize"] +use ../../pkgs/nu-git-manager/nu-git-manager/fs path ["path sanitize"] # return the path to a random test directory # From a660163c43e7cdb02de308abf13c55021c763df3 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Sat, 23 Dec 2023 11:15:29 +0100 Subject: [PATCH 05/10] remove deprecated `--switch: bool` (#154) related to - https://github.com/nushell/nushell/pull/11365 ## description this PR will suppress the deprecation warning from https://github.com/nushell/nushell/pull/11365 which is deprecating `: bool` annotations for switches --- pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu | 2 +- .../nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu | 2 +- pkgs/nu-git-manager-sugar/tests/git.nu | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu index d5ddf8a..af3bcce 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/git.nu @@ -40,7 +40,7 @@ use style.nu [color] # │ type │ detached │ # ╰──────┴──────────╯ export def get-revision [ - --short-hash: bool # print the hash of a detached HEAD in short format + --short-hash # print the hash of a detached HEAD in short format ]: nothing -> record { let tag = do -i { ^git describe HEAD --tags diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu index 6fa21fd..181d4b0 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/lib/prompt.nu @@ -31,7 +31,7 @@ export def get-left-prompt [duration_threshold: duration]: nothing -> string { } let git_branch_segment = if $is_git_repo { - let revision = get-revision --short-hash true + let revision = get-revision --short-hash let pretty_branch_tokens = match $revision.type { "branch" => [ ($revision.name | color {fg: "yellow", attr: "ub"}), diff --git a/pkgs/nu-git-manager-sugar/tests/git.nu b/pkgs/nu-git-manager-sugar/tests/git.nu index 9e67eca..fbd1f55 100644 --- a/pkgs/nu-git-manager-sugar/tests/git.nu +++ b/pkgs/nu-git-manager-sugar/tests/git.nu @@ -380,7 +380,7 @@ export module prompt { ] def "assert revision" [expected: record] { - let actual = get-revision --short-hash true + let actual = get-revision --short-hash assert equal $actual $expected } From 6ca2a444bfc704b8d44dbbfd2d0f061fde427c89 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Sat, 20 Jan 2024 16:15:21 +0100 Subject: [PATCH 06/10] fix spreading of arguments to externals (#156) related to - https://github.com/nushell/nushell/pull/11289 wait for - https://github.com/nushell/nupm/pull/57 --- pkgs/nu-git-manager/nu-git-manager/mod.nu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/nu-git-manager/nu-git-manager/mod.nu b/pkgs/nu-git-manager/nu-git-manager/mod.nu index 1699a18..b6f094c 100644 --- a/pkgs/nu-git-manager/nu-git-manager/mod.nu +++ b/pkgs/nu-git-manager/nu-git-manager/mod.nu @@ -139,7 +139,7 @@ export def "gm clone" [ } } - ^git clone $args + ^git clone ...$args ^git -C $local_path remote set-url $remote $urls.fetch ^git -C $local_path remote set-url $remote --push $urls.push From 4d27ff4bb84ac1d59adcd20b46e91ebaf366d50e Mon Sep 17 00:00:00 2001 From: amtoine Date: Sun, 21 Jan 2024 09:21:02 +0100 Subject: [PATCH 07/10] bump NGM to 0.5.0 --- pkgs/nu-git-manager-sugar/nupm.nuon | 2 +- pkgs/nu-git-manager/nupm.nuon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/nu-git-manager-sugar/nupm.nuon b/pkgs/nu-git-manager-sugar/nupm.nuon index 974b12f..2ea6a9a 100644 --- a/pkgs/nu-git-manager-sugar/nupm.nuon +++ b/pkgs/nu-git-manager-sugar/nupm.nuon @@ -1,6 +1,6 @@ { name: "nu-git-manager-sugar" - version: 0.4.0 + version: 0.5.0 description: "A collection of extra Nushell tools to manage `git` repositories." documentation: "https://github.com/amtoine/nu-git-manager/blob/main/README.md" maintainers: [ diff --git a/pkgs/nu-git-manager/nupm.nuon b/pkgs/nu-git-manager/nupm.nuon index e17af38..4e70161 100644 --- a/pkgs/nu-git-manager/nupm.nuon +++ b/pkgs/nu-git-manager/nupm.nuon @@ -1,6 +1,6 @@ { name: "nu-git-manager" - version: 0.4.0 + version: 0.5.0 description: "A collection of Nushell tools to manage `git` repositories." documentation: "https://github.com/amtoine/nu-git-manager/blob/main/README.md" maintainers: [ From 08c231f105f6b1801887ef8e16cb577d5599f692 Mon Sep 17 00:00:00 2001 From: amtoine Date: Sun, 21 Jan 2024 09:22:09 +0100 Subject: [PATCH 08/10] bump Nushell to 0.89.0 --- .github/workflows/ci.yml | 4 ++-- pkgs/nu-git-manager-sugar/nupm.nuon | 2 +- pkgs/nu-git-manager/nupm.nuon | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fc71c9..91cda59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: tests: uses: ./.github/workflows/nupm-tests.yml with: - nu_version: "0.88.1" + nu_version: "0.89.0" nupm_revision: "6a9618fa21453bca4000ac33707b7aace0da35c7" documentation: uses: ./.github/workflows/check-documentation.yml with: - nu_version: "0.88.1" + nu_version: "0.89.0" diff --git a/pkgs/nu-git-manager-sugar/nupm.nuon b/pkgs/nu-git-manager-sugar/nupm.nuon index 2ea6a9a..bee1672 100644 --- a/pkgs/nu-git-manager-sugar/nupm.nuon +++ b/pkgs/nu-git-manager-sugar/nupm.nuon @@ -9,7 +9,7 @@ ] license: "https://github.com/amtoine/nu-git-manager/blob/main/LICENSE" dependencies: { - nushell: 0.88.1 + nushell: 0.89.0 git: 2.40.1 optionals: { "sugar gh": { diff --git a/pkgs/nu-git-manager/nupm.nuon b/pkgs/nu-git-manager/nupm.nuon index 4e70161..9fa9895 100644 --- a/pkgs/nu-git-manager/nupm.nuon +++ b/pkgs/nu-git-manager/nupm.nuon @@ -9,7 +9,7 @@ ] license: "https://github.com/amtoine/nu-git-manager/blob/main/LICENSE" dependencies: { - nushell: 0.88.1 + nushell: 0.89.0 git: 2.40.1 } type: "module" From 6a80c0644538f240b19da179bcb0d0120468dc51 Mon Sep 17 00:00:00 2001 From: amtoine Date: Sun, 21 Jan 2024 09:22:17 +0100 Subject: [PATCH 09/10] bump Nupm to latest revision this includes nushell/nupm#57 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91cda59..57437cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: uses: ./.github/workflows/nupm-tests.yml with: nu_version: "0.89.0" - nupm_revision: "6a9618fa21453bca4000ac33707b7aace0da35c7" + nupm_revision: "66e2eaa848e3f72c1b4a841f26f4dc7efc4fedb9" documentation: uses: ./.github/workflows/check-documentation.yml From 44995d57b802c3fb1dd363625b9889389c221d64 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Sun, 21 Jan 2024 09:30:39 +0100 Subject: [PATCH 10/10] fix nightly types (#160) --- pkgs/nu-git-manager/nu-git-manager/git/url.nu | 4 ++-- pkgs/nu-git-manager/nu-git-manager/mod.nu | 2 +- pkgs/nu-git-manager/tests/mod.nu | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgs/nu-git-manager/nu-git-manager/git/url.nu b/pkgs/nu-git-manager/nu-git-manager/git/url.nu index 8744270..a4ca65d 100644 --- a/pkgs/nu-git-manager/nu-git-manager/git/url.nu +++ b/pkgs/nu-git-manager/nu-git-manager/git/url.nu @@ -28,8 +28,8 @@ export def parse-git-url []: string -> record]: nothing -> nothing { + def "assert cache" [cache: list]: nothing -> nothing { let actual = open-cache $CACHE | update path { path remove-prefix (pwd | path sanitize) } let expected = $cache | each {|it|