2015-10-07 04:31:44 +08:00
|
|
|
function __omf.packages.sort
|
|
|
|
for package in (echo $argv | tr ' ' '\n' | sort); echo $package; end
|
|
|
|
end
|
|
|
|
|
2015-10-14 10:51:18 +08:00
|
|
|
function __omf.packages.builtin
|
|
|
|
echo "omf"
|
|
|
|
end
|
|
|
|
|
2015-10-07 04:31:44 +08:00
|
|
|
function __omf.packages.list -a type
|
|
|
|
set -l list
|
|
|
|
|
2015-11-04 19:28:06 +08:00
|
|
|
test "$type" = "--theme"; or for package in (basename -a {$OMF_CONFIG,$OMF_PATH/db}/pkg/*)
|
2015-10-14 10:51:18 +08:00
|
|
|
contains $package (__omf.packages.builtin); or set list $list $package
|
2015-10-07 04:31:44 +08:00
|
|
|
end
|
|
|
|
|
2015-11-04 19:28:06 +08:00
|
|
|
test "$type" = "--plugin"; or for package in (basename -a {$OMF_CONFIG,$OMF_PATH/db}/themes/*)
|
2015-10-07 04:31:44 +08:00
|
|
|
set list $list $package
|
|
|
|
end
|
|
|
|
|
|
|
|
__omf.packages.sort $list
|
|
|
|
end
|
|
|
|
|
|
|
|
function __omf.packages.list.available -a type
|
|
|
|
set -l list
|
|
|
|
|
|
|
|
test "$type" = "--theme"; or for package in (basename $OMF_PATH/db/pkg/*)
|
2015-11-04 19:28:06 +08:00
|
|
|
contains $package (basename -a {$OMF_CONFIG,$OMF_PATH}/pkg/*); or set list $list $package
|
2015-10-07 04:31:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
test "$type" = "--plugin"; or for package in (basename $OMF_PATH/db/themes/*)
|
2015-11-04 19:28:06 +08:00
|
|
|
contains $package (basename -a {$OMF_CONFIG,$OMF_PATH}/themes/*); or set list $list $package
|
2015-10-07 04:31:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
__omf.packages.sort $list
|
|
|
|
end
|
|
|
|
|
|
|
|
function __omf.packages.list.database -a type
|
|
|
|
set -l list
|
|
|
|
|
2015-11-04 19:28:06 +08:00
|
|
|
test "$type" = "--theme"; or for package in (basename -a $OMF_PATH/db/pkg/*)
|
2015-10-07 04:31:44 +08:00
|
|
|
set list $list $package
|
|
|
|
end
|
|
|
|
|
2015-11-04 19:28:06 +08:00
|
|
|
test "$type" = "--plugin"; or for package in (basename -a $OMF_PATH/db/themes/*)
|
2015-10-07 04:31:44 +08:00
|
|
|
set list $list $package
|
|
|
|
end
|
|
|
|
|
|
|
|
__omf.packages.sort $list
|
|
|
|
end
|
|
|
|
|
|
|
|
function __omf.packages.list.installed -a type
|
|
|
|
set -l list
|
|
|
|
|
2015-11-04 19:28:06 +08:00
|
|
|
test "$type" = "--theme"; or for package in (basename -a {$OMF_CONFIG,$OMF_PATH}/pkg/*)
|
2015-10-14 10:51:18 +08:00
|
|
|
contains $package (__omf.packages.builtin); or set list $list $package
|
2015-10-07 04:31:44 +08:00
|
|
|
end
|
|
|
|
|
2015-11-04 19:28:06 +08:00
|
|
|
test "$type" = "--plugin"; or for package in (basename -a {$OMF_CONFIG,$OMF_PATH}/themes/*)
|
2015-10-07 04:31:44 +08:00
|
|
|
set list $list $package
|
|
|
|
end
|
|
|
|
|
|
|
|
__omf.packages.sort $list
|
|
|
|
end
|
|
|
|
|
|
|
|
function omf.packages.list -a option type
|
|
|
|
switch "$option"
|
|
|
|
case "--available"
|
|
|
|
__omf.packages.list.available $type
|
|
|
|
case "--database"
|
|
|
|
__omf.packages.list.database $type
|
|
|
|
case "--installed"
|
|
|
|
__omf.packages.list.installed $type
|
|
|
|
case "*"
|
|
|
|
__omf.packages.list $type
|
|
|
|
end
|
|
|
|
end
|