diff --git a/src/nu-git-manager-sugar/git/lib/lib.nu b/src/nu-git-manager-sugar/git/lib/lib.nu index 494f14d0..88e06d8b 100644 --- a/src/nu-git-manager-sugar/git/lib/lib.nu +++ b/src/nu-git-manager-sugar/git/lib/lib.nu @@ -1,3 +1,5 @@ +use ../../git/lib/style.nu [color] + # give the revision of the repo you're in # # in the output, $.type is guaranteed to be one of diff --git a/src/nu-git-manager-sugar/git/lib/prompt.nu b/src/nu-git-manager-sugar/git/lib/prompt.nu index 2604637a..f949f2ba 100644 --- a/src/nu-git-manager-sugar/git/lib/prompt.nu +++ b/src/nu-git-manager-sugar/git/lib/prompt.nu @@ -1,11 +1,5 @@ -# TODO: write a test -def simplify-path []: path -> string { - str replace $nu.home-path "~" | str replace --regex '^/' "!/" -} - -def color [color]: string -> string { - $"(ansi $color)($in)(ansi reset)" -} +use ../../git/lib/lib.nu [get-revision, git-action] +use ../../git/lib/style.nu [color, simplify-path] # TODO: write a test export def get-left-prompt [duration_threshold: duration]: nothing -> string { diff --git a/src/nu-git-manager-sugar/git/lib/style.nu b/src/nu-git-manager-sugar/git/lib/style.nu new file mode 100644 index 00000000..dba6f0fd --- /dev/null +++ b/src/nu-git-manager-sugar/git/lib/style.nu @@ -0,0 +1,7 @@ +export def simplify-path []: path -> string { + str replace $nu.home-path "~" | str replace --regex '^/' "!/" +} + +export def color [color]: string -> string { + $"(ansi $color)($in)(ansi reset)" +} diff --git a/src/nu-git-manager-sugar/git/prompt.nu b/src/nu-git-manager-sugar/git/prompt.nu index 3d05115e..14d08f87 100644 --- a/src/nu-git-manager-sugar/git/prompt.nu +++ b/src/nu-git-manager-sugar/git/prompt.nu @@ -1,4 +1,3 @@ -use ../git/lib/lib.nu [get-revision, git-action] use ../git/lib/prompt.nu [get-left-prompt] const DEFAULT_PROMPT_INDICATORS = {