commit 4bb0691c2c3f311429605bd42df28262e95bb28d
Author: abs3nt <abs3nt@asdf.cafe>
Date:   Mon Mar 3 18:33:02 2025 -0800

    fish

diff --git a/completions/repo.fish b/completions/repo.fish
new file mode 100644
index 0000000..ab12a31
--- /dev/null
+++ b/completions/repo.fish
@@ -0,0 +1,21 @@
+function __repo_commands
+    echo "get\tClone a repository"
+    echo "open\tOpen the repository in a browser"
+    echo "aur\tClone an AUR repository"
+    echo "list\tList all repositories"
+    echo "go\tNavigate to a repository"
+    echo "goto\tNavigate to a repository"
+    echo "new\tCreate a new repository"
+    echo "create\tCreate a new repository"
+    echo "help\tShow help message"
+end
+
+function __repo_needs_command
+    set -l cmd (commandline -opc)
+    if test (count $cmd) -eq 1
+        return 0
+    end
+    return 1
+end
+
+complete -f -c repo -n __repo_needs_command -a '(__repo_commands)'
diff --git a/functions/_repo_clean_path.fish b/functions/_repo_clean_path.fish
new file mode 100644
index 0000000..8dde086
--- /dev/null
+++ b/functions/_repo_clean_path.fish
@@ -0,0 +1,16 @@
+function _repo_clean_path
+    set stripped $argv[1]
+
+    for prefix in "http://" "https://" "git@" "ssh://" "aur@"
+        if string match -q "$prefix*" $stripped
+            set stripped (string replace -r "^$prefix" "" $stripped)
+        end
+    end
+
+    set stripped (echo $stripped | sed -e "s/:/\//1")
+
+    if not string match -q "*/*" $stripped
+        set stripped "github.com/$stripped"
+    end
+    echo $stripped
+end
diff --git a/functions/_repo_clone.fish b/functions/_repo_clone.fish
new file mode 100644
index 0000000..770fd8d
--- /dev/null
+++ b/functions/_repo_clone.fish
@@ -0,0 +1,24 @@
+function _repo_clone
+    if test -z "$argv[2]"
+        echo "Error: Repository path is required"
+        return 1
+    end
+
+    set repo_prefix $argv[1]
+    set cleaned (_repo_clean_path $argv[2])
+    set output_path "$REPO_BASE_DIR/$cleaned"
+    # Remove .git suffix if present
+    set trimmed (string replace -r '(\.git)$' '' "$output_path")
+
+    mkdir -p "$trimmed"
+
+    if not test -d "$trimmed/.git"
+        set repourl (echo "$repo_prefix@$cleaned" | sed -e "s/\//:/1")
+        echo "Cloning $repourl to $trimmed..."
+        git clone "$repourl" "$trimmed"
+    else
+        echo "Repository already exists: $trimmed"
+    end
+
+    _repo_post_clone "$trimmed"
+end
diff --git a/functions/_repo_goto.fish b/functions/_repo_goto.fish
new file mode 100644
index 0000000..3751277
--- /dev/null
+++ b/functions/_repo_goto.fish
@@ -0,0 +1,12 @@
+function _repo_goto
+    if test -z "$argv[1]"
+        echo "Error: Repository path is required"
+        return 1
+    end
+
+    set cleaned (_repo_clean_path $argv[1])
+    set output_path "$REPO_BASE_DIR/$cleaned"
+    # Remove .git suffix if present
+    set trimmed (string replace -r '(\.git)$' '' "$output_path")
+    _repo_post_goto $trimmed
+end
diff --git a/functions/_repo_help.fish b/functions/_repo_help.fish
new file mode 100644
index 0000000..9ed1914
--- /dev/null
+++ b/functions/_repo_help.fish
@@ -0,0 +1,17 @@
+function _repo_help
+    cat < < EOF
+    Usage: repo <command > < repository >
+    Commands:
+    get Clone a repository to the repos directory
+    open Open the current repository in the browser
+    aur Clone an AUR repository
+    list List all repositories
+    go | goto Navigate to a repository
+    new | create Create a new repository
+    help Show this help message
+
+    Examples:
+    repo get github.com/user/repo
+    repo open
+    EOF
+end
diff --git a/functions/_repo_list.fish b/functions/_repo_list.fish
new file mode 100644
index 0000000..e919328
--- /dev/null
+++ b/functions/_repo_list.fish
@@ -0,0 +1,6 @@
+function _repo_list
+    for git_dir in (find "$REPO_BASE_DIR" -type d -name ".git")
+        set parent_dir (dirname "$git_dir")
+        echo (basename "$parent_dir" | sed 's/\./_/g')
+    end
+end
diff --git a/functions/_repo_new.fish b/functions/_repo_new.fish
new file mode 100644
index 0000000..30948ab
--- /dev/null
+++ b/functions/_repo_new.fish
@@ -0,0 +1,20 @@
+function _repo_new
+    if test -z "$argv[1]"
+        echo "Error: Repository path is required"
+        return 1
+    end
+
+    set cleaned (_repo_clean_path $argv[1])
+    set output_path "$REPO_BASE_DIR/$cleaned"
+    # Remove .git suffix if present
+    set trimmed (string replace -r '(\.git)$' '' "$output_path")
+    mkdir -p "$trimmed"
+
+    if not test -d "$trimmed/.git"
+        git init "$trimmed"
+    else
+        echo "Repository already exists: $trimmed"
+    end
+
+    _repo_post_new "$trimmed"
+end
diff --git a/functions/_repo_open.fish b/functions/_repo_open.fish
new file mode 100644
index 0000000..c4cc7fa
--- /dev/null
+++ b/functions/_repo_open.fish
@@ -0,0 +1,6 @@
+function _repo_open
+    set remote (git remote get-url origin)
+    set remote (string replace -r "git@" "https://" $remote)
+    set remote (string replace --max=1 ":" "/" $remote)
+    xdg-open "$remote"
+end
diff --git a/functions/_repo_post_clone.fish b/functions/_repo_post_clone.fish
new file mode 100644
index 0000000..defe9e2
--- /dev/null
+++ b/functions/_repo_post_clone.fish
@@ -0,0 +1,7 @@
+function _repo_post_clone
+    if functions -q repo_post_clone
+        repo_post_clone $argv[1]
+    else
+        cd $argv[1]
+    end
+end
diff --git a/functions/_repo_post_goto.fish b/functions/_repo_post_goto.fish
new file mode 100644
index 0000000..b77992e
--- /dev/null
+++ b/functions/_repo_post_goto.fish
@@ -0,0 +1,7 @@
+function repo_post_goto
+    if functions -q repo_post_goto
+        repo_post_goto $argv[1]
+    else
+        cd $argv[1]
+    end
+end
diff --git a/functions/_repo_post_new.fish b/functions/_repo_post_new.fish
new file mode 100644
index 0000000..cb82b54
--- /dev/null
+++ b/functions/_repo_post_new.fish
@@ -0,0 +1,7 @@
+function _repo_post_new
+    if functions -q repo_post_new
+        repo_post_new $argv
+    else
+        cd $argv[1]
+    end
+end
diff --git a/functions/repo.fish b/functions/repo.fish
new file mode 100644
index 0000000..4ad076d
--- /dev/null
+++ b/functions/repo.fish
@@ -0,0 +1,25 @@
+function repo
+    set cmd $argv[1]
+    set arg $argv[2]
+
+    switch $cmd
+        case get
+            _repo_clone git $arg
+        case aur
+            _repo_clone aur $arg
+        case open
+            _repo_open
+        case list
+            _repo_list
+        case go goto
+            _repo_goto $arg
+        case new create
+            _repo_new $arg
+        case help -h -help --help
+            _repo_help
+        case '*'
+            echo "Unknown command: $cmd"
+            _repo_help
+            return 1
+    end
+end