Skip to content

Commit

Permalink
feat: alias_safe command
Browse files Browse the repository at this point in the history
  • Loading branch information
r4ai committed Jul 2, 2022
1 parent a5e1634 commit 3792ab3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ supports wsl2(may be few commands not working) and macOS.
- copy --> just copy. Supports win(wsl) & mac.
- open_fish_config/ofc --> Just open the fish config file.
- get_os_name --> Returns the name of the OS distribution you are currently using.
- alias_safe --> make alias if given command has already installed. (experimental)

## how to install
### using fisher
Expand Down
15 changes: 15 additions & 0 deletions functions/alias_safe.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function alias_safe
set -f key $argv[1]
set -f value $argv[2]

set -f command (echo (string split ' ' $value)[1])

# echo "key: $key"
# echo "value: $value"
# echo "command: $command"

#* main
if type -q $command
alias $key $value
end
end

0 comments on commit 3792ab3

Please sign in to comment.