Home

dotnix @main - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
tree log patch
update nushell functions Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQLz4b5BT7Eq5WCVH/T8AsGVNHLGYwPi4lrH+c6lNDg9JFTO1yXybGaaOt0QowCh/7s Uv0Qr+AZHutzbGewnIQwM= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
1 month ago
3 changed files, 33 additions(+), 48 deletions(-)
M apps/nogui/nushell.nixapps/nogui/nushell.nix
diff --git a/apps/nogui/nushell.nix b/apps/nogui/nushell.nix
index fbcd56ee81da006ed4b575eee03c5e923743f8b1..409239611e1cd8cb1aa55d9e8f568099420fc02c 100644
--- a/apps/nogui/nushell.nix
+++ b/apps/nogui/nushell.nix
@@ -33,6 +33,7 @@   xdg.configFile = {
     "nushell/jolheiser.nu".source = ./nushell/jolheiser.nu;
     "nushell/ssh.nu".source = ./nushell/ssh.nu;
     "nushell/miniserve.nu".source = ./nushell/miniserve.nu;
+    "nushell/clone.nu".source = ./nushell/clone.nu;
     "nushell/ohmyposh.nu".source = ./nushell/ohmyposh.nu;
   };
 }
I apps/nogui/nushell/clone.nu
diff --git a/apps/nogui/nushell/clone.nu b/apps/nogui/nushell/clone.nu
new file mode 100644
index 0000000000000000000000000000000000000000..1e686813aa3b0a5b5893706726bb8277dd8a928f
--- /dev/null
+++ b/apps/nogui/nushell/clone.nu
@@ -0,0 +1,31 @@
+def "forge types" [] {
+  ["github", "gitea", "jojodev", "codeberg"]
+}
+
+export def clone [
+  repo: string # Repo name
+  --forge (-f) = "github": string@"forge types" # Forge type (github, gitea, jojodev, codeberg)
+  --owner (-o): string # Owner (default: current dir name)
+] {
+  mut id = 'gh'
+  if $forge == 'gitea' {
+    $id = 'gt'
+  } else if $forge == 'jojodev' {
+    $id = 'jj'
+  } else if $forge == 'codeberg' {
+    $id = 'cb'
+  }
+  mut namespace = ($env.PWD | path basename)
+  if $owner != '' {
+    $namespace = $owner
+  }
+  let origin = $'ssh:($id):jolheiser/($repo).git'
+  let upstream = $'($id):($namespace)/($repo).git'
+  ^git clone $origin
+  cd $repo
+  if $namespace != 'jolheiser' {
+    ^git remote add upstream $upstream
+    ^git fetch upstream
+  }
+}
+
M apps/nogui/nushell/jolheiser.nuapps/nogui/nushell/jolheiser.nu
diff --git a/apps/nogui/nushell/jolheiser.nu b/apps/nogui/nushell/jolheiser.nu
index 121628560c3dd6a0a10fedf555f773c5ac638e2c..f004a2e093bbf568e063bd070e352fffb5a7e12c 100644
--- a/apps/nogui/nushell/jolheiser.nu
+++ b/apps/nogui/nushell/jolheiser.nu
@@ -7,54 +7,6 @@ alias just = just --shell "nu" --shell-arg "-c"
 alias ll = ls -al
 
 ## Functions ##
-def sshdev [port: int = 8080] {
-	$"Listening on localhost:($port)"
-	^ssh -i ~/.ssh/dev -N -T -R $"1337:localhost:($port)" dev@jolheiser.com
-}
-
-def nixdev [
-		name: string    # Name of the dev shell to use
-		--bash          # Use bash instead of nushell
-		--refresh       # Refresh the flake
-	] {
-	let url = $"git+https://git.jojodev.com/jolheiser/dev-shells\#($name)"
-	let c = if ($bash) {""} else {"-c nu"}
-	let refresh = if ($refresh) {"--refresh"} else {""}
-	let cmd = $"nix develop ($refresh) ($url) ($c)"
-	^nu -c $cmd
-}
-
-def "forge types" [] {
-  ["github", "gitea", "jojodev", "codeberg"]
-}
-
-def clone [
-  repo: string # Repo name
-  --forge (-f) = "github": string@"forge types" # Forge type (github, gitea, jojodev, codeberg)
-  --owner (-o): string # Owner (default: current dir name)
-] {
-  mut id = 'gh'
-  if $forge == 'gitea' {
-    $id = 'gt'
-  } else if $forge == 'jojodev' {
-    $id = 'jj'
-  } else if $forge == 'codeberg' {
-    $id = 'cb'
-  }
-  mut namespace = ($env.PWD | path basename)
-  if $owner != '' {
-    $namespace = $owner
-  }
-  let origin = $'ssh:($id):jolheiser/($repo).git'
-  let upstream = $'($id):($namespace)/($repo).git'
-  ^git clone $origin
-  cd $repo
-  if $namespace != 'jolheiser' {
-    ^git remote add upstream $upstream
-    ^git fetch upstream
-  }
-}
-
 def fg [args ...string] {
   ^rg --ignore-case --color=always --line-number --no-heading $args 
   | ^fzf --ansi --color 'hl:-1:underline,hl+:-1:underline:reverse' --delimiter ':' --preview "bat --color=always {1} --theme='ctp-mocha' --highlight-line {2}" --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' --bind $"enter:become\(($env.EDITOR) +{2} {1}\)"
@@ -103,3 +55,4 @@ $env.SSH_AUTH_SOCK = '/run/user/1000/ssh-agent'
 source ~/.config/nushell/ohmyposh.nu
 source ~/.config/nushell/ssh.nu
 source ~/.config/nushell/miniserve.nu
+source ~/.config/nushell/clone.nu