From 26e932f44509bc665f6e5b51df3bbac8b9fabe74 Mon Sep 17 00:00:00 2001 From: abs3nt <abs3nt@asdf.cafe> Date: Mon, 3 Mar 2025 18:08:28 -0800 Subject: [PATCH] nvrmind --- functions/clone.fish | 23 ------------------ functions/core.fish | 14 ----------- functions/goto.fish | 11 --------- functions/help.fish | 16 ------------- functions/hooks.fish | 11 --------- functions/list.fish | 6 ----- functions/new.fish | 19 --------------- functions/open.fish | 6 ----- functions/repo.fish | 25 ------------------- readme.md | 57 -------------------------------------------- repo.plugin.fish | 6 ----- 11 files changed, 194 deletions(-) delete mode 100644 functions/clone.fish delete mode 100644 functions/core.fish delete mode 100644 functions/goto.fish delete mode 100644 functions/help.fish delete mode 100644 functions/hooks.fish delete mode 100644 functions/list.fish delete mode 100644 functions/new.fish delete mode 100644 functions/open.fish delete mode 100644 functions/repo.fish delete mode 100644 repo.plugin.fish diff --git a/functions/clone.fish b/functions/clone.fish deleted file mode 100644 index 53dedbc..0000000 --- a/functions/clone.fish +++ /dev/null @@ -1,23 +0,0 @@ -function repo_clone - if test -z "$argv[2]" - echo "Error: Repository path is required" - return 1 - end - - set repo_prefix $argv[1] - set cleaned (clean_repo_path "$argv[2]") - set output_path "$REPO_BASE_DIR/$cleaned" - set suffix ".git" - set clean_path (string replace -r "$suffix\$" "" "$output_path") - - mkdir -p "$clean_path" - - if test ! -d "$clean_path/.git" - set repourl (string replace "/" ":" "$repo_prefix@$cleaned" -r) - echo "Cloning $repourl to $clean_path..." - git clone "$repourl" "$clean_path" - else - echo "Repository already exists: $clean_path" - end - post_repo_clone "$clean_path" -end \ No newline at end of file diff --git a/functions/core.fish b/functions/core.fish deleted file mode 100644 index 3b52700..0000000 --- a/functions/core.fish +++ /dev/null @@ -1,14 +0,0 @@ -function clean_repo_path - set stripped $argv[1] - set stripped (string replace -r "^http://" "" $stripped) - set stripped (string replace -r "^https://" "" $stripped) - set stripped (string replace -r "^git@" "" $stripped) - set stripped (string replace -r "^ssh://" "" $stripped) - set stripped (string replace -r "^aur@" "" $stripped) - set stripped (string replace -r ":" "/" $stripped) - - if not string match -q "*/*" $stripped - set stripped "github.com/$stripped" - end - echo "$stripped" -end \ No newline at end of file diff --git a/functions/goto.fish b/functions/goto.fish deleted file mode 100644 index faa4110..0000000 --- a/functions/goto.fish +++ /dev/null @@ -1,11 +0,0 @@ -function repo_goto - if test -z "$argv[1]" - echo "Error: Repository path is required" - return 1 - end - - set cleaned (clean_repo_path "$argv[1]") - set output_path "$REPO_BASE_DIR/$cleaned" - set suffix ".git" - post_repo_goto (string replace -r "$suffix\$" "" "$output_path") -end \ No newline at end of file diff --git a/functions/help.fish b/functions/help.fish deleted file mode 100644 index 8731c73..0000000 --- a/functions/help.fish +++ /dev/null @@ -1,16 +0,0 @@ -function repo_help - echo "Usage: repo <command> <repository>" - echo "" - echo "Commands:" - echo " get Clone a repository to the repos directory" - echo " open Open the current repository in the browser" - echo " aur Clone an AUR repository" - echo " list List all repositories" - echo " go|goto Navigate to a repository" - echo " new|create Create a new repository" - echo " help Show this help message" - echo "" - echo "Examples:" - echo " repo get github.com/user/repo" - echo " repo open" -end \ No newline at end of file diff --git a/functions/hooks.fish b/functions/hooks.fish deleted file mode 100644 index cdba203..0000000 --- a/functions/hooks.fish +++ /dev/null @@ -1,11 +0,0 @@ -function post_repo_clone - cd "$argv[1]" -end - -function post_repo_goto - cd "$argv[1]" -end - -function post_repo_new - cd "$argv[1]" -end \ No newline at end of file diff --git a/functions/list.fish b/functions/list.fish deleted file mode 100644 index 99ed1cb..0000000 --- a/functions/list.fish +++ /dev/null @@ -1,6 +0,0 @@ -function list_repos - find "$REPO_BASE_DIR" -type d -name ".git" | while read -l git_dir - set parent_dir (dirname "$git_dir") - string replace -r '.*/' '' "$parent_dir" | string replace -a '.' '_' - end -end \ No newline at end of file diff --git a/functions/new.fish b/functions/new.fish deleted file mode 100644 index 708c104..0000000 --- a/functions/new.fish +++ /dev/null @@ -1,19 +0,0 @@ -function repo_new - if test -z "$argv[1]" - echo "Error: Repository path is required" - return 1 - end - - set cleaned (clean_repo_path "$argv[1]") - set output_path "$REPO_BASE_DIR/$cleaned" - set clean_path (string replace -r "\.git\$" "" "$output_path") - mkdir -p "$clean_path" - - if test ! -d "$clean_path/.git" - git init "$clean_path" - else - echo "Repository already exists: $clean_path" - end - - post_repo_new "$clean_path" -end \ No newline at end of file diff --git a/functions/open.fish b/functions/open.fish deleted file mode 100644 index c443ac9..0000000 --- a/functions/open.fish +++ /dev/null @@ -1,6 +0,0 @@ -function repo_open - set remote (git remote get-url origin) - set remote (string replace "git@" "https://" $remote) - set remote (string replace ":" "/" $remote) - xdg-open "$remote" -end \ No newline at end of file diff --git a/functions/repo.fish b/functions/repo.fish deleted file mode 100644 index 24a0acb..0000000 --- a/functions/repo.fish +++ /dev/null @@ -1,25 +0,0 @@ -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' - list_repos - 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 \ No newline at end of file diff --git a/readme.md b/readme.md index 70a615f..450d9bf 100644 --- a/readme.md +++ b/readme.md @@ -16,20 +16,6 @@ sheldon add repo-manager --github abs3ntdev/repo-manager zinit light abs3ntdev/repo-manager ``` -### Fish - -- Fisher - -``` -fisher install abs3ntdev/repo-manager -``` - -- Oh My Fish - -``` -omf install abs3ntdev/repo-manager -``` - ## usage ``` @@ -88,41 +74,6 @@ post_repo_new() { } ``` -#### Fish - -Hooks are configured by overriding the functions provided in the plugin in hooks.fish -The default hooks are: - -```fish -function post_repo_clone - cd "$argv[1]" -end - -function post_repo_goto - cd "$argv[1]" -end - -function post_repo_new - cd "$argv[1]" -end -``` - -You can override these in your config.fish or in a file sourced by your config.fish to do whatever you want. Example: - -```fish -function post_repo_clone - code "$argv[1]" -end - -function post_repo_goto - nvim "$argv[1]" -end - -function post_repo_new - some_script "$argv[1]" -end -``` - ### base directory #### ZSH @@ -132,11 +83,3 @@ The base directory is set via ENV. The default is $HOME/repos. You can change th ```zsh export REPO_BASE_DIR="whatever/you/want" ``` - -#### Fish - -The base directory is set via ENV. The default is $HOME/repos. You can change this by adding the following to your config.fish: - -```fish -set -g REPO_BASE_DIR "whatever/you/want" -``` diff --git a/repo.plugin.fish b/repo.plugin.fish deleted file mode 100644 index 6042614..0000000 --- a/repo.plugin.fish +++ /dev/null @@ -1,6 +0,0 @@ -set -q REPO_BASE_DIR; or set -g REPO_BASE_DIR "$HOME/repos" - -set functions_dir (status dirname)/functions -for script in $functions_dir/*.fish - source $script -end \ No newline at end of file