mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-24 00:52:01 +08:00
73 lines
1.8 KiB
Fish
73 lines
1.8 KiB
Fish
function __omf.packages.sort
|
|
for package in (echo $argv | tr ' ' '\n' | sort); echo $package; end
|
|
end
|
|
|
|
function __omf.packages.list -a type
|
|
set -l list
|
|
|
|
test "$type" = "--theme"; or for package in (basename {$OMF_CONFIG,$OMF_PATH/db}/pkg/*)
|
|
set list $list $package
|
|
end
|
|
|
|
test "$type" = "--plugin"; or for package in (basename {$OMF_CONFIG,$OMF_PATH/db}/themes/*)
|
|
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/*)
|
|
contains $package (basename {$OMF_CONFIG,$OMF_PATH}/pkg/*); or set list $list $package
|
|
end
|
|
|
|
test "$type" = "--plugin"; or for package in (basename $OMF_PATH/db/themes/*)
|
|
contains $package (basename {$OMF_CONFIG,$OMF_PATH}/themes/*); or set list $list $package
|
|
end
|
|
|
|
__omf.packages.sort $list
|
|
end
|
|
|
|
function __omf.packages.list.database -a type
|
|
set -l list
|
|
|
|
test "$type" = "--theme"; or for package in (basename $OMF_PATH/db/pkg/*)
|
|
set list $list $package
|
|
end
|
|
|
|
test "$type" = "--plugin"; or for package in (basename $OMF_PATH/db/themes/*)
|
|
set list $list $package
|
|
end
|
|
|
|
__omf.packages.sort $list
|
|
end
|
|
|
|
function __omf.packages.list.installed -a type
|
|
set -l list
|
|
|
|
test "$type" = "--theme"; or for package in (basename {$OMF_CONFIG,$OMF_PATH}/pkg/*)
|
|
set list $list $package
|
|
end
|
|
|
|
test "$type" = "--plugin"; or for package in (basename {$OMF_CONFIG,$OMF_PATH}/themes/*)
|
|
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
|