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
521b7bb7
Commit
521b7bb7
authored
Jan 06, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepend_path allowing multiple paths to be specified at once
parent
25dbd9ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
13 deletions
+51
-13
functions/_prepend_path.fish
functions/_prepend_path.fish
+45
-7
oh-my-fish.fish
oh-my-fish.fish
+6
-6
No files found.
functions/_prepend_path.fish
View file @
521b7bb7
# Prepends the path to the specified path list. If no list specified, defaults to $PATH
# NAME
# _prepend_path - adds a path to a list
#
# SYNOPSIS
# _prepend_path [-d --destination <destination path>] <path>
#
# DESCRIPTION
# Adds a path to a list.
# If no list specified, defaults to $PATH
#
# OPTIONS
# <path>
# Required. Specify the path to add to the list.
#
# [<glob> [<operator> <glob>..]]
# Glob pattern to match when traversing the path path.
#
# OPERATORS
# -d <DESTINATION PATH>
# Should appear at the end if used. Specifies the name of the
# list to prepend the paths to.
# If not used, $PATH is assumed by default.
#
# EXAMPLES
# _prepend_path $path
# Add $path to $PATH
#
# _prepend_path $path -d $fish_function_path
# Add $path to $fish_function_path
#/
function _prepend_path
function _prepend_path
set -l path PATH
set -l destination_path PATH #$PATH is the default destination path
set -l len (count $argv)
set -l path $argv
if test (echo $argv | wc -w) -eq 2
if test $len -gt 2
set path $argv[2]
switch $argv[-2]
case -d --destination
set destination_path $argv[-1]
set path $argv[1..-3]
end
end
end
if test -d $argv[1]
for path in $path
if not contains $argv[1] $$path
if test -d $path
set $path $argv[1] $$path
if not contains $path $$destination_path
set $destination_path $path $$destination_path
end
end
end
end
end
end
end
oh-my-fish.fish
View file @
521b7bb7
...
@@ -6,16 +6,16 @@ function _fish_add_plugin
...
@@ -6,16 +6,16 @@ function _fish_add_plugin
set -l plugin $argv[1]
set -l plugin $argv[1]
set -l plugin_path "plugins/$plugin"
set -l plugin_path "plugins/$plugin"
_prepend_path $fish_path/$plugin_path fish_function_path
_prepend_path $fish_path/$plugin_path
-d
fish_function_path
_prepend_path $fish_custom/$plugin_path fish_function_path
_prepend_path $fish_custom/$plugin_path
-d
fish_function_path
end
end
function _fish_add_completion
function _fish_add_completion
set -l plugin $argv[1]
set -l plugin $argv[1]
set -l completion_path "plugins/$plugin/completions"
set -l completion_path "plugins/$plugin/completions"
_prepend_path $fish_path/$completion_path fish_complete_path
_prepend_path $fish_path/$completion_path
-d
fish_complete_path
_prepend_path $fish_custom/$completion_path fish_complete_path
_prepend_path $fish_custom/$completion_path
-d
fish_complete_path
end
end
function _fish_source_plugin_load_file
function _fish_source_plugin_load_file
...
@@ -32,8 +32,8 @@ function _fish_source_plugin_load_file
...
@@ -32,8 +32,8 @@ function _fish_source_plugin_load_file
end
end
function _fish_load_theme
function _fish_load_theme
_prepend_path $fish_path/themes/$fish_theme fish_function_path
_prepend_path $fish_path/themes/$fish_theme
-d
fish_function_path
_prepend_path $fish_custom/themes/$fish_theme fish_function_path
_prepend_path $fish_custom/themes/$fish_theme
-d
fish_function_path
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