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
7025525e
Commit
7025525e
authored
Oct 06, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify `omf cd` code
This also namespace the function to `omf.packages`.
parent
394ca55d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
27 deletions
+24
-27
pkg/omf/cli/omf.cd.fish
pkg/omf/cli/omf.cd.fish
+0
-25
pkg/omf/cli/omf.packages.cd.fish
pkg/omf/cli/omf.packages.cd.fish
+22
-0
pkg/omf/omf.fish
pkg/omf/omf.fish
+2
-2
No files found.
pkg/omf/cli/omf.cd.fish
deleted
100644 → 0
View file @
394ca55d
# SYNOPSIS
# Change the current working directory to plugin / theme home directory.
#
# OPTIONS
# <name> Name of the package or theme.
function omf.cd -a name -d "Change the current working directory to plugin / theme home directory."
if test -z $name
pushd $OMF_PATH
return 0
end
if test -e $OMF_CONFIG/pkg/$name
pushd $OMF_CONFIG/pkg/$name
else if test -e $OMF_CONFIG/themes/$name
pushd $OMF_CONFIG/themes/$name
else if test -e $OMF_PATH/pkg/$name
pushd $OMF_PATH/pkg/$name
else if test -e $OMF_PATH/themes/$name
pushd $OMF_PATH/themes/$name
else
echo (omf::err)"$name is not a valid package/theme name"(omf::off) 1^&2
return $OMF_INVALID_ARG
end
end
pkg/omf/cli/omf.packages.cd.fish
0 → 100644
View file @
7025525e
# SYNOPSIS
# Change the current working directory to plugin / theme home directory.
#
# OPTIONS
# <name> Name of the package or theme.
function omf.packages.cd -a name -d "Change the current working directory to plugin / theme home directory."
if test -z "$name"
pushd $OMF_PATH
return 0
end
for path in {$OMF_CONFIG,$OMF_PATH}/{pkg,themes}/$name
if test -e "$path"
pushd $path
return 0
end
end
echo (omf::err)"$name is not a valid package/theme name"(omf::off) 1^&2
return $OMF_INVALID_ARG
end
pkg/omf/omf.fish
View file @
7025525e
...
@@ -55,9 +55,9 @@ function omf -d "Oh My Fish"
...
@@ -55,9 +55,9 @@ function omf -d "Oh My Fish"
case "c" "cd"
case "c" "cd"
switch (count $argv)
switch (count $argv)
case 1
case 1
omf.cd
omf.
packages.
cd
case 2
case 2
omf.cd $argv[2]
omf.
packages.
cd $argv[2]
case "*"
case "*"
echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <name>" 1^&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <name>" 1^&2
...
...
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