Gabriel Capella пре 5 дана
родитељ
комит
065942e63c
2 измењених фајлова са 28 додато и 2 уклоњено
  1. 12 0
      dots/.config/fish/completions/dotsync.fish
  2. 16 2
      dots/.config/fish/functions/dotsync.fish

+ 12 - 0
dots/.config/fish/completions/dotsync.fish

@@ -0,0 +1,12 @@
+# Completions for dotsync command
+
+# Subcommands
+complete -c dotsync -f -n "not __fish_seen_subcommand_from sync list status" -a "sync" -d "Sync dotfiles"
+complete -c dotsync -f -n "not __fish_seen_subcommand_from sync list status" -a "list" -d "List synced dotfiles"
+complete -c dotsync -f -n "not __fish_seen_subcommand_from sync list status" -a "status" -d "Show git status"
+
+# Help option
+complete -c dotsync -f -s h -l help -d "Show help message"
+
+# For sync subcommand, complete with files from home directory
+complete -c dotsync -n "__fish_seen_subcommand_from sync" -a "(__fish_complete_path \$HOME/)" -d "Dotfile to add"

+ 16 - 2
dots/.config/fish/functions/dotsync.fish

@@ -1,3 +1,17 @@
-function dotsync
-    command $HOME/.dofiles/dotfiles/start sync
+function dotsync --description "Manage dotfiles synchronization"
+    set -l dotfiles_script "$HOME/.dofiles/dotfiles/start"
+
+    # Check if the start script exists
+    if not test -x "$dotfiles_script"
+        echo "Error: Dotfiles script not found at $dotfiles_script" >&2
+        return 1
+    end
+
+    # If no arguments provided, default to sync
+    if test (count $argv) -eq 0
+        command "$dotfiles_script" sync
+    else
+        # Pass all arguments to the start script
+        command "$dotfiles_script" $argv
+    end
 end