Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
14902584
Commit
14902584
authored
Mar 01, 2015
by
Dave Yarwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for sudo command aliases
parent
849fcbec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
plugins/better-alias/balias.fish
plugins/better-alias/balias.fish
+1
-2
plugins/better-alias/balias.spec.fish
plugins/better-alias/balias.spec.fish
+6
-0
No files found.
plugins/better-alias/balias.fish
View file @
14902584
function balias --argument alias command
function balias --argument alias command
eval 'alias $alias $command'
eval 'alias $alias $command'
if expr $command : '^sudo '>/dev/null
if expr $command : '^sudo '>/dev/null
set command (e
xpr substr + $command 6 (expr length $command)
)
set command (e
cho "$command" | cut -c6-
)
end
end
complete -c $alias -xa "(
complete -c $alias -xa "(
set -l cmd (commandline -pc | sed -e 's/^ *\S\+ *//' );
set -l cmd (commandline -pc | sed -e 's/^ *\S\+ *//' );
complete -C\"$command \$cmd\";
complete -C\"$command \$cmd\";
)"
)"
end
end
plugins/better-alias/balias.spec.fish
View file @
14902584
...
@@ -5,6 +5,7 @@ function describe_library -d "better-alias"
...
@@ -5,6 +5,7 @@ function describe_library -d "better-alias"
function after_all
function after_all
functions -e changedir
functions -e changedir
functions -e ls_as_root
end
end
function it_doesnt_fail
function it_doesnt_fail
...
@@ -25,6 +26,11 @@ function describe_library -d "better-alias"
...
@@ -25,6 +26,11 @@ function describe_library -d "better-alias"
rmdir testdir
rmdir testdir
end
end
function it_chops_off_sudo
balias ls_as_root 'sudo ls'
expect test $status --to-be-true
end
end
end
spec.run $argv
spec.run $argv
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment