mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-17 01:52:45 +08:00
completions/magento: remove sed dependency
This runs in about half the time, too.
This commit is contained in:
parent
3c74f14569
commit
245ee466cb
|
@ -15,10 +15,23 @@ end
|
|||
###
|
||||
|
||||
function __fish_print_magento_modules -d "Lists all Magento modules"
|
||||
test -f app/etc/config.php; or return
|
||||
command -q sed; or return
|
||||
set -l config_path app/etc/config.php
|
||||
test -f $config_path; or return
|
||||
|
||||
command sed -n '/modules.*\[/,/\]/p' app/etc/config.php | sed -E '1d;$d;s/^\s*|\s*=>.*$|"|\'//g'
|
||||
set -l in_modules 0
|
||||
cat $config_path | \
|
||||
while read -l line
|
||||
if test "$in_modules" -eq 0
|
||||
if string match -rq '[\'"]modules[\'"]\s*=>.*\[' -- $line
|
||||
set in_modules 1;
|
||||
end
|
||||
else
|
||||
if string match -rq '^\s*]\s*,\s*$' -- $line
|
||||
break
|
||||
end
|
||||
string replace -rf '\s*[\'"](.*?)[\'"]\s*=>.*' '$1' -- $line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_print_magento_i18n_packing_modes -d "Shows all available packing modes"
|
||||
|
|
Loading…
Reference in New Issue
Block a user