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 a092f1da..d5ddf8af 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 00000000..6a62b940 --- /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 e9349ba1..6fa21fdb 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 25a470ba..e3784151 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 2b7bb029..22248f59 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 f40089d0..bdb38974 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 879c2246..051228c6 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 { @@ -354,13 +354,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 02f20794..264fa637 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 00000000..d221af7b --- /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 00000000..6247e39b --- /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 5d3995d9..dc07eeaa 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 714144d2..87442707 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 3c00f714..1699a18d 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 ceb9f978..d27b0127 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 2081a46d..212b992a 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 476e2588..ae2f4d42 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 #