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
7b0a7ef7
Commit
7b0a7ef7
authored
Dec 17, 2014
by
Jorge Bucaran
Committed by
Bruno Pinto
Dec 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -P --preview flag to help debug/test command.
parent
a51dc2d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
functions/_prepend_tree.fish
functions/_prepend_tree.fish
+18
-6
No files found.
functions/_prepend_tree.fish
View file @
7b0a7ef7
...
...
@@ -13,6 +13,10 @@
# files. Return 1 if the source path is not specified.
#
# OPTIONS
# -P --preview
# Use to skip adding anything to the path and echo all matched
# directories to stdout. Useful for debugging/testing.
#
# <SOURCE PATH>
# Required. Specify the path to find glob matches to prepend
# to the destination path.
...
...
@@ -25,7 +29,6 @@
# It is also possible to use logical OR / AND operators to list
# multiple globs. If none is used, OR is assumed by default.
# The OR operator
#
# The following operators are available:
#
...
...
@@ -79,10 +82,16 @@ function _prepend_tree -d "Load a dependency tree, matching `.fish` files by def
set -l glob
set -l depth 1
set -l len (count $argv)
set -l preview false
[ $len -gt 0 ]
and set source $argv[1]
or return 1
if [ $len -gt 0 ]
switch $argv[1]
case -P --preview
set preview true
set -e argv[1]
set len (count $argv)
end
end
[ $len -gt 0 ]
and set source $argv[1]
...
...
@@ -123,7 +132,10 @@ function _prepend_tree -d "Load a dependency tree, matching `.fish` files by def
and set glob -name \*.fish
for directory in $source/**/
[ -z (find $directory $glob -maxdepth $depth | head -1) ]
or _prepend_path $directory $destination
if not [ -z (find $directory $glob -maxdepth $depth | head -1) ]
eval $preview # skip when on preview mode
and printf "%s " $directory
or _prepend_path $directory $destination
end
end
end
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