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
17de8c4b
Commit
17de8c4b
authored
May 31, 2016
by
Derek Willian Stavis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
list: refactor code, fix fish 2.3.0 globs (#325)
parent
ce978438
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
52 deletions
+68
-52
pkg/omf/functions/cli/omf.cli.help.fish
pkg/omf/functions/cli/omf.cli.help.fish
+3
-1
pkg/omf/functions/cli/omf.cli.list.fish
pkg/omf/functions/cli/omf.cli.list.fish
+10
-12
pkg/omf/functions/packages/omf.packages.list.fish
pkg/omf/functions/packages/omf.packages.list.fish
+55
-39
No files found.
pkg/omf/functions/cli/omf.cli.help.fish
View file @
17de8c4b
...
...
@@ -62,7 +62,9 @@ function omf.cli.help -a command
List local packages.
"(omf::dim)"Usage:"(omf::off)"
omf list
omf list [ --available | -a ]
omf list [ --installed | -i ]
omf list [ --database | -d ]
"
case "n" "new"
...
...
pkg/omf/functions/cli/omf.cli.list.fish
View file @
17de8c4b
function omf.cli.list -a type
test -z "$type"; and set type '--installed'
if contains -- $type '--available' '-a' '--database' '-d' '--installed' '-i'
omf.packages.list $type | column
else
echo (omf::err)"Invalid arguments"(omf::off)
echo 'Usage: omf list [ --available | -a ]'
echo ' omf list [ --installed | -i ]'
echo ' omf list [ --database | -d ]'
return $OMF_INVALID_ARG
function omf.cli.list
switch (count $argv)
case 0
echo (set_color -u)Plugins(set_color normal)
omf.packages.list --installed --plugin | column
echo
echo (set_color -u)Themes(set_color normal)
omf.packages.list --installed --theme | column
case '*'
omf.packages.list $argv | column
end
end
pkg/omf/functions/packages/omf.packages.list.fish
View file @
17de8c4b
function __omf.packages.sort
for package in (echo $argv | tr ' ' '\n' | sort); echo $package; end
end
function __omf.packages.builtin
echo "omf"
echo "fish-spec"
end
function __omf.packages.list -a type
set -l list
test "$type" = "--theme"; or for package in (basename -a {$OMF_CONFIG,$OMF_PATH/db}/pkg/*)
contains $package (__omf.packages.builtin); or set list $list $package
end
set -l builtin_package_path {$OMF_PATH,$OMF_CONFIG}/pkg*/{omf,fish-spec}
test "$type" = "--plugin"; or for package in (basename -a {$OMF_CONFIG,$OMF_PATH/db}/themes/*)
set list $list $package
function __omf.packages.basename
set -l IFS /
for path in $argv
echo $path | read -la components
echo $components[-1]
end
__omf.packages.sort $list
end
function __omf.packages.list.available -a type
set -l list
test "$type" = "--theme"; or for package in (basename -a $OMF_PATH/db/pkg/*)
contains $package (basename -a {$OMF_CONFIG,$OMF_PATH}/pkg/*); or set list $list $package
set -l database_package_path $OMF_PATH/db/pkg/*
set -l database_theme_path $OMF_PATH/db/themes/*
set -l installed_package_path {$OMF_CONFIG,$OMF_PATH}/pkg/*
set -l installed_theme_path {$OMF_CONFIG,$OMF_PATH}/themes/*
set -l database_packages (__omf.packages.basename $database_package_path)
set -l database_themes (__omf.packages.basename $database_theme_path)
set -l installed_packages (__omf.packages.basename $installed_package_path)
set -l installed_themes (__omf.packages.basename $installed_theme_path)
test "$type" = "--theme"; or for package in $database_packages
contains $package $installed_packages; or echo $package
end
test "$type" = "--plugin"; or for
package in (basename -a $OMF_PATH/db/themes/*)
contains $pa
ckage (basename -a {$OMF_CONFIG,$OMF_PATH}/themes/*); or set list $list $packag
e
test "$type" = "--plugin"; or for
theme in $database_themes
contains $pa
th $installed_themes; or echo $them
e
end
__omf.packages.sort $list
end
function __omf.packages.list.database -a type
set -l list
set -l database_package_path $OMF_PATH/db/pkg/*
set -l database_theme_path $OMF_PATH/db/themes/*
test "$type" = "--theme"; or for pa
ckage in (basename -a $OMF_PATH/db/pkg/*)
set list $list $pa
ckage
test "$type" = "--theme"; or for pa
th in $database_package_path
set list $list $pa
th
end
test "$type" = "--plugin"; or for pa
ckage in (basename -a $OMF_PATH/db/themes/*)
set list $list $pa
ckage
test "$type" = "--plugin"; or for pa
th in $database_theme_path
set list $list $pa
th
end
__omf.packages.
sort
$list
__omf.packages.
basename
$list
end
function __omf.packages.list.installed -a type
set -l list
set -l installed_package_path $OMF_PATH/pkg/*
set -l installed_theme_path $OMF_PATH/themes/*
test "$type" = "--theme"; or for pa
ckage in (basename -a {$OMF_CONFIG,$OMF_PATH}/pkg/*)
contains $pa
ckage (__omf.packages.builtin); or set list $list $package
test "$type" = "--theme"; or for pa
th in $installed_package_path
contains $pa
th $builtin_package_path; or set list $list $path
end
test "$type" = "--plugin"; or for pa
ckage in (basename -a {$OMF_CONFIG,$OMF_PATH}/themes/* 2>/dev/null)
set list $list $pa
ckage
test "$type" = "--plugin"; or for pa
th in $installed_theme_path
set list $list $pa
th
end
__omf.packages.
sort
$list
__omf.packages.
basename
$list
end
function omf.packages.list -a option type
function omf.packages.list
set -l type_index (begin
contains -i -- --theme $argv
contains -i -- -t $argv
contains -i -- --plugin $argv
contains -i -- -p $argv
end)
set -l option_index (begin
contains -i -- --available $argv
contains -i -- -a $argv
contains -i -- --installed $argv
contains -i -- -i $argv
contains -i -- --database $argv
contains -i -- -d $argv
end)
set -l option $argv[$option_index]
set -l type $argv[$type_index]
switch "$option"
case "-a" "--available"
__omf.packages.list.available $type
...
...
@@ -72,6 +88,6 @@ function omf.packages.list -a option type
case "-i" "--installed"
__omf.packages.list.installed $type
case "*"
__omf.packages.list $type
__omf.packages.list
.installed
$type
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