Compare commits

..

21 Commits
2.6b1 ... 2.6.0

Author SHA1 Message Date
David Adam
b0389cb77d Bump version for 2.6.0 2017-06-03 20:45:13 +08:00
David Adam
eb01106751 CHANGELOG: updates for 2.6.0 2017-06-03 18:21:34 +08:00
Kurtis Rader
80d9c3ec8b document that set -n output is sorted
(cherry picked from commit c263c59346)
2017-06-03 12:16:26 +08:00
Kevin Ballard
4a724ce40e Fix usage of osascript in help
Work around a macOS osascript bug in 10.12.5 which prevented help from
working. See #4035.

(cherry picked from commit 3061eed647)
2017-06-03 12:16:25 +08:00
Kurtis Rader
1c06067d0d fix bug in ~ completion
Fix bug introduced by commit c114cbc9a that causes only the first match
for a ~ completion to be available for selection.

Fixes #4075

(cherry picked from commit eff2a3c3a3)
2017-05-27 16:31:06 -07:00
Kurtis Rader
8ed63d63a4 note in the tutorial the vars that are auto split
Users continue to be surprised that fish auto splits/joins three env
vars but not other similar vars. Mention this in the tutorial to make it
less likely new users are surprised by this behavior.

Fixes #4009

(cherry picked from commit 6f6d3ce520)
2017-05-27 23:00:33 +08:00
Kurtis Rader
06ea31d0ab improve bash history importing
Reject more invalid commands from the bash history file.

Fixes #3636

(cherry picked from commit 6c4a51d56e)
2017-05-27 23:00:33 +08:00
Fabian Homborg
44830589ab type: Fix "-a"
This matched _all_ executable commands, where it should only match all
executable commands _with the given name_.

Fixes #4070.

(cherry picked from commit 0fc9ec5538)
2017-05-26 18:04:18 -07:00
Kurtis Rader
ee572a13c8 fix regression introduced by 21521b2
The problem was overlooking a `break` statement when refactoring a
`switch` block into a simpler `if...else...` block. This fixes the
behavior of the `history-token-search-backward` function and its forward
searching analog.

Fixes #4065

(cherry picked from commit 8f78e71b6d)
2017-05-25 21:00:07 -07:00
Kevin Ballard
8d4d47b548 Handle missing groff macro in __fish_print_help
The Xcode installation of Fish is missing the groff macro used by
`__fish_print_help`. This caused e.g. `status -h` to stop working.

Fixes #4058.

(cherry picked from commit 9bc1b44b0d)
2017-05-25 22:37:31 +08:00
Kevin Ballard
80afc31ff8 Turn off bracketed paste when Fish exits
(cherry picked from commit 4ff002b9fb)
2017-05-25 22:37:31 +08:00
Kurtis Rader
0bf4d398ab fix killall completions
This fixes the obvious error in handling the `-u` short flag.
See issue #4052.

(cherry picked from commit a71bb03f23)
2017-05-25 22:37:31 +08:00
Fabian Homborg
4b53cd583d docs: Change misleading $status comment for set
It still performs the assignment even if the command substitution
returned unsuccessfully - `set foo (echo bar; false)` returns 1 but
sets $foo to bar.

Also use `type -p` instead of `which`.

(cherry picked from commit 0ee24b9bce)
2017-05-22 21:27:25 +08:00
Fabian Homborg
fdea1abf70 docs: Improve faq-exit-status
Add examples, a mention of `if command` and link to test/if.

See #2773.

(cherry picked from commit 64d33fac5d)
2017-05-22 21:27:25 +08:00
Fabian Homborg
3cca94b268 help: Properly error out when no browser is found
See #4045.

(cherry picked from commit 036b708d99)
2017-05-19 16:46:51 +08:00
Mo
291d88a72f Added Magento2 CLI completions (#4043)
* Added Magento2 CLI completions

This is the completion file for the Magento2 CLI application I use on my servers. It has an additional feature tho, I'm not sure if it fits into the fish completion philosophy:
If you provide limited access credentials, it will connect to the MySQL database and provide additional suggestions, such as available users, themes or indexers in the database. If this file is never touched, those suggestions simply won't show up. I, personally, find them to be pretty useful, though.

Should I remove those database suggestions before creating a PR?

* Removed functions using MySQL, updated formatting

* Several smaller fixes

* Improved descriptions

Tried to shorten the text as much as possible and removed unnecessary characters

(cherry picked from commit 71f5fe1ece)
2017-05-19 16:46:51 +08:00
Kurtis Rader
40679560a6 make wreaddir() handle broken struct dirent
Some platforms do not correctly define `struct dirent` so that its
`d_name` member is long enough for the longest file name. Work around
such broken definitions.

Fixes #4030

(cherry picked from commit a5a9ca7d3b)
2017-05-17 22:37:55 -07:00
Sven Sternberger
c9c802d3fc Update __fish_print_hostnames.fish
For Ubuntu the default global known host files are :
/etc/ssh/ssh_known_hosts
/etc/ssh/ssh_known_hosts2
(cherry picked from commit cbd9181b7e)
2017-05-17 23:27:34 +08:00
David Adam
ec1f00e59b CHANGELOG: updates for 2.6.0 2017-05-16 13:07:55 +08:00
Alan Somers
a5d3ac8444 Fix syntax error in gphoto2 completions 2017-05-15 21:57:33 -07:00
ridiculousfish
4050166738 Fix lru.h compilation on Yosemite
The LRU cache wants to store references from nodes back into the
lookup map, so that it is efficient to remove a node from the
map. However certain compilers refuse to form a std::map::iterator
with an incomplete type. Fix this by storing a pointer to the key
instead of the iterator.

(cherry picked from commit 523dc6da6d)
2017-05-16 10:09:19 +08:00
22 changed files with 781 additions and 102 deletions

View File

@@ -1,3 +1,15 @@
# fish 2.6.0 (released June 3, 2017)
Since the beta release of fish 2.6b1, fish version 2.6.0 contains a number of minor fixes, new completions for `magneto` (#4043), and improvements to the documentation.
## Known issues
- Apple macOS Sierra 10.12.5 introduced a problem with launching web browsers from other programs using AppleScript. This affects the fish Web configuration (`fish_config`); users on these platforms will need to manually open the address displayed in the terminal, such as by copying and pasting it into a browser. This problem will be fixed with macOS 10.12.6.
If you are upgrading from version 2.5.0 or before, please also review the release notes for 2.6b1 (included below).
---
# fish 2.6b1 (released May 14, 2017)
## Notable fixes and improvements

View File

@@ -86,6 +86,26 @@ end
Use the `$status` variable. This replaces the `$?` variable used in some other shells.
\fish{cli-dark}
somecommand
if test $status -eq 7
echo "That's my lucky number!"
end
\endfish
If you are just interested in success or failure, you can run the command directly as the if-condition:
\fish{cli-dark}
if somecommand
echo "Command succeeded"
else
echo "Command failed"
end
\endfish
See the documentation for <a href="commands.html#test">`test`</a> and <a href="commands.html#if">`if`</a> for more information.
Use the <a href="commands.html#fish_update_completions">`fish_update_completions`</a> command.
<hr>
\section faq-single-env How do I set an environment variable for just one command?

View File

@@ -14,7 +14,7 @@ set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
`set` manipulates <a href="index.html#variables">shell variables</a>.
If set is called with no arguments, the names and values of all shell variables are printed. If some of the scope or export flags have been given, only the variables matching the specified scope are printed.
If set is called with no arguments, the names and values of all shell variables are printed in sorted order. If some of the scope or export flags have been given, only the variables matching the specified scope are printed.
With both variable names and values provided, `set` assigns the variable `VARIABLE_NAME` the values `VALUES...`.
@@ -37,7 +37,7 @@ The following options are available:
- `-q` or `--query` test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
- `-n` or `--names` List only the names of all defined variables, not their value
- `-n` or `--names` List only the names of all defined variables, not their value. The names are guaranteed to be sorted.
- `-L` or `--long` do not abbreviate long values when printing set variables
@@ -70,7 +70,7 @@ In erase mode, if variable indices are specified, only the specified slices of t
`set` requires all options to come before any other arguments. For example, `set flags -l` will have the effect of setting the value of the variable `flags` to '-l', not making the variable local.
In assignment mode, `set` exits with a non-zero exit status if variable assignments could not be successfully performed. If the variable assignments were performed, the exit status is unchanged. This allows simultaneous capture of the output and exit status of a subcommand, e.g. `if set output (command)`. In query mode, the exit status is the number of variables that were not found. In erase mode, `set` exits with a zero exit status in case of success, with a non-zero exit status if the commandline was invalid, if the variable was write-protected or if the variable did not exist.
In assignment mode, `set` does not modify the exit status. This allows simultaneous capture of the output and exit status of a subcommand, e.g. `if set output (command)`. In query mode, the exit status is the number of variables that were not found. In erase mode, `set` exits with a zero exit status in case of success, with a non-zero exit status if the commandline was invalid, if the variable was write-protected or if the variable did not exist.
\subsection set-example Example
@@ -87,8 +87,8 @@ set -e smurf
set PATH[4] ~/bin
# Changes the fourth element of the $PATH array to ~/bin
if set python_path (which python)
if set python_path (type -p python)
echo "Python is at $python_path"
end
# Outputs the path to Python if `which` returns true.
# Outputs the path to Python if `type -p` returns true.
\endfish

View File

@@ -300,6 +300,8 @@ Other variables, like `$PATH`, really do have multiple values. During variable e
<outp>/usr/bin /bin /usr/sbin /sbin /usr/local/bin</outp>
\endfish
Note that there are three environment variables that are automatically split on colons to become lists when fish starts running: `PATH`, `CDPATH`, `MANPATH`. Conversely, they are joined on colons when exported to subcommands. All other environment variables (e.g., `LD_LIBRARY_PATH`) which have similar semantics are treated as simple strings.
Lists cannot contain other lists: there is no recursion. A variable is a list of strings, full stop.
Get the length of a list with `count`:

View File

@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.5.900</string>
<string>2.6.0</string>
<key>CFBundleVersion</key>
<string>0.1</string>
<key>LSApplicationCategoryType</key>

View File

@@ -200,7 +200,7 @@
#define PACKAGE_NAME "fish"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "fish 2.6b1"
#define PACKAGE_STRING "fish 2.6.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "fish"
@@ -209,7 +209,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.6b1"
#define PACKAGE_VERSION "2.6.0"
/* The size of `wchar_t', as computed by sizeof. */
#define SIZEOF_WCHAR_T 4

View File

@@ -1,6 +1,6 @@
#Common options
complete -c gphoto2 -s '?'-l 'help' -d 'Print complete help message on program usage'
complete -c gphoto2 -s '?' -l 'help' -d 'Print complete help message on program usage'
complete -c gphoto2 -l 'usage' -d 'Print short message on program usage'
complete -c gphoto2 -l 'debug' -d 'Turn on debugging'
complete -c gphoto2 -l 'debug-logfile' -r -d 'Name of file to write debug info to'

View File

@@ -1,44 +1,46 @@
# For Solaris, `killall` kills all processes, so we really don't want to invoke it.
# On Solaris, `killall` kills all processes. So we don't want to bother providing completion
# support on that OS.
set -l OS (uname)
if test "$OS" != 'SunOS'
__fish_make_completion_signals
for i in $__kill_signals
set -l numname (string split " " -- $i)
set -l number $numname[1]
set -q numname[2]
and set -l name $numname[2]
complete -c killall -o $number -d $name
complete -c killall -o $name
# Doesn't work in OS X; -s is simulate
test "$OS" != 'Darwin'
and complete -c killall -s s -x -a "$number $name"
end
complete -c killall -xa '(__fish_complete_proc)'
if killall --version >/dev/null ^/dev/null # GNU
complete -c killall -s e -l exact -d 'Require an exact match for very long names'
complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
complete -c killall -s i -l interactive -d 'Interactively ask for confirmation before killing'
complete -c killall -s u -l user -d 'Kill only processes the specified user owns. Command names are optional' -x
complete -c killall -s -u -l user -x -a "(__fish_complete_users)"
complete -c killall -s w -l wait -d 'Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state'
complete -c killall -s v -l version -d 'Print version'
else
complete -c killall -s v -d 'Be more verbose about what will be done'
complete -c killall -s e -d 'Use effective user ID instead of the real user ID for matching processes specified with the -u option'
complete -c killall -s help -d 'Print help and exit'
complete -c killall -s l -d 'List names of available signals and exit'
complete -c killall -s m -d 'Case sensitive argument match for processed'
complete -c killall -s s -d 'Simulate, but do not send any signals'
complete -c killall -s d -d "Print detailed info. Doesn't send signals"
complete -c killall -s u -x -d 'Only processes for USER'
complete -c killall -s -u -l user -x -a "(__fish_complete_users)"
complete -c killall -s t -d 'Limit to processes running on specified TTY'
complete -c killall -s t -xa "(ps a -o tty | sed 1d | uniq)"
complete -c killall -s c -x -d 'Limit to processes matching specified PROCNAME'
complete -c killall -s z -d 'Do not skip zombies'
end
if test "$OS" = 'SunOS'
exit 0
end
__fish_make_completion_signals
for i in $__kill_signals
set -l numname (string split " " -- $i)
set -l number $numname[1]
set -q numname[2]
and set -l name $numname[2]
complete -c killall -o $number -d $name
complete -c killall -o $name
# The `-s` flag doesn't work in OS X
test "$OS" != 'Darwin'
and complete -c killall -s s -x -a "$number $name"
end
complete -c killall -xa '(__fish_complete_proc)'
if killall --version >/dev/null ^/dev/null # GNU
complete -c killall -s e -l exact -d 'Require an exact match for very long names'
complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
complete -c killall -s i -l interactive -d 'Interactively ask for confirmation before killing'
complete -c killall -s u -l user -x -a "(__fish_complete_users)" -d 'Kill only processes the specified user owns. Command names are optional'
complete -c killall -s w -l wait -d 'Wait for all killed processes to die'
complete -c killall -s v -l version -d 'Print version'
else # probably BSD
complete -c killall -s v -d 'Be more verbose about what will be done'
complete -c killall -s e -d 'Use effective UID instead of the real UID for matching processes specified with the -u option'
complete -c killall -s help -d 'Print help and exit'
complete -c killall -s l -d 'List names of available signals and exit'
complete -c killall -s m -d 'Case sensitive argument match for processed'
complete -c killall -s s -d 'Simulate, but do not send any signals'
complete -c killall -s d -d "Print detailed info. Doesn't send signals"
complete -c killall -s u -x -a "(__fish_complete_users)" -d 'Kill only processes the specified user owns. Command names are optional'
complete -c killall -s -u -l user -x -a "(__fish_complete_users)"
complete -c killall -s t -d 'Limit to processes running on specified TTY'
complete -c killall -s t -xa "(ps a -o tty | sed 1d | uniq)"
complete -c killall -s c -x -d 'Limit to processes matching specified PROCNAME'
complete -c killall -s z -d 'Do not skip zombies'
end

View File

@@ -0,0 +1,621 @@
function __fish_print_magento_url_protocols -d "Shows all available URL protocols"
echo http://
echo https://
end
function __fish_print_magento_mysql_engines
echo MyISAM\t"MyISAM storage engine"
echo InnoDB\t"Supports transactions, row-level locking, and foreign keys"
echo BLACKHOLE\t"/dev/null storage engine (anything you write to it disappears)"
echo MEMORY\t"Hash based, stored in memory, useful for temporary tables"
echo CSV\t"CSV storage engine"
echo ARCHIVE\t"Archive storage engine"
end
###
function __fish_print_magento_modules -d "Lists all Magento modules"
set -l modules (magento module:status)
for i in $test
if test -n "$i" -a "$i" != "None"
echo $i
end
end
end
function __fish_magento_print_indexer_modes -d "Lists all indexer modes"
echo realtime\t"Index in realtime"
echo schedule\t"Index via cron jobs"
end
function __fish_print_magento_i18n_packing_modes -d "Shows all available packing modes"
echo replace\t"replace language pack by new one"
echo merge\t"merge language packages"
end
function __fish_print_magento_available_ides -d "Shows all IDEs supported by magento"
echo phpstorm\t"JetBrains PhpStorm"
end
function __fish_print_magento_available_tests -d "Shows all available magento tests"
echo all\t"all tests"
echo unit\t"unit tests only"
echo integration\t"integration tests only"
echo integration-all\t"all integration tests"
echo static\t"static file tests only"
echo static-all\t"all static file tests"
echo integrity\t"integrity tests only"
echo legacy\t"legacy tests only"
echo default\t"all tests"
end
function __fish_print_magento_theme_areas -d "Shows all available magento theme areas"
echo frontend\t"Frontend"
echo adminhtml\t"Backend"
end
function __fish_print_magento_languages -d "Shows all existing magento languages"
echo af_ZA\t"Afrikaans (South Africa)"
echo sq_AL\t"Albanian (Albania)"
echo ar_DZ\t"Arabic (Algeria)"
echo ar_EG\t"Arabic (Egypt)"
echo ar_KW\t"Arabic (Kuwait)"
echo ar_MA\t"Arabic (Morocco)"
echo ar_SA\t"Arabic (Saudi Arabia)"
echo az_Latn_AZ\t"Azerbaijani (Azerbaijan)"
echo eu_ES\t"Basque (Spain)"
echo be_BY\t"Belarusian (Belarus)"
echo bn_BD\t"Bengali (Bangladesh)"
echo bs_Latn_BA\t"Bosnian (Bosnia and Herzegovina)"
echo bg_BG\t"Bulgarian (Bulgaria)"
echo ca_ES\t"Catalan (Spain)"
echo zh_Hans_CN\t"Chinese (China)"
echo zh_Hant_HK\t"Chinese (Hong Kong SAR China)"
echo zh_Hant_TW\t"Chinese (Taiwan)"
echo hr_HR\t"Croatian (Croatia)"
echo cs_CZ\t"Czech (Czech Republic)"
echo da_DK\t"Danish (Denmark)"
echo nl_BE\t"Dutch (Belgium)"
echo nl_NL\t"Dutch (Netherlands)"
echo en_AU\t"English (Australia)"
echo en_CA\t"English (Canada)"
echo en_IE\t"English (Ireland)"
echo en_NZ\t"English (New Zealand)"
echo en_GB\t"English (United Kingdom)"
echo en_US\t"English (United States)"
echo et_EE\t"Estonian (Estonia)"
echo fil_PH\t"Filipino (Philippines)"
echo fi_FI\t"Finnish (Finland)"
echo fr_BE\t"French (Belgium)"
echo fr_CA\t"French (Canada)"
echo fr_FR\t"French (France)"
echo gl_ES\t"Galician (Spain)"
echo ka_GE\t"Georgian (Georgia)"
echo de_AT\t"German (Austria)"
echo de_DE\t"German (Germany)"
echo de_CH\t"German (Switzerland)"
echo el_GR\t"Greek (Greece)"
echo gu_IN\t"Gujarati (India)"
echo he_IL\t"Hebrew (Israel)"
echo hi_IN\t"Hindi (India)"
echo hu_HU\t"Hungarian (Hungary)"
echo is_IS\t"Icelandic (Iceland)"
echo id_ID\t"Indonesian (Indonesia)"
echo it_IT\t"Italian (Italy)"
echo it_CH\t"Italian (Switzerland)"
echo ja_JP\t"Japanese (Japan)"
echo km_KH\t"Khmer (Cambodia)"
echo ko_KR\t"Korean (South Korea)"
echo lo_LA\t"Lao (Laos)"
echo lv_LV\t"Latvian (Latvia)"
echo lt_LT\t"Lithuanian (Lithuania)"
echo mk_MK\t"Macedonian (Macedonia)"
echo ms_Latn_MY\t"Malay (Malaysia)"
echo mn_Cyrl_MN\t"Mongolian (Mongolia)"
echo nb_NO\t"Norwegian Bokmål (Norway)"
echo nn_NO\t"Norwegian Nynorsk (Norway)"
echo fa_IR\t"Persian (Iran)"
echo pl_PL\t"Polish (Poland)"
echo pt_BR\t"Portuguese (Brazil)"
echo pt_PT\t"Portuguese (Portugal)"
echo ro_RO\t"Romanian (Romania)"
echo ru_RU\t"Russian (Russia)"
echo sr_Cyrl_RS\t"Serbian (Serbia)"
echo sk_SK\t"Slovak (Slovakia)"
echo sl_SI\t"Slovenian (Slovenia)"
echo es_AR\t"Spanish (Argentina)"
echo es_CL\t"Spanish (Chile)"
echo es_CO\t"Spanish (Colombia)"
echo es_CR\t"Spanish (Costa Rica)"
echo es_MX\t"Spanish (Mexico)"
echo es_PA\t"Spanish (Panama)"
echo es_PE\t"Spanish (Peru)"
echo es_ES\t"Spanish (Spain)"
echo es_VE\t"Spanish (Venezuela)"
echo sw_KE\t"Swahili (Kenya)"
echo sv_SE\t"Swedish (Sweden)"
echo th_TH\t"Thai (Thailand)"
echo tr_TR\t"Turkish (Turkey)"
echo uk_UA\t"Ukrainian (Ukraine)"
echo vi_VN\t"Vietnamese (Vietnam)"
echo cy_GB\t"Welsh (United Kingdom)"
end
function __fish_print_magento_source_theme_file_types -d "Shows all available source theme file types"
echo less\t"Currently only LESS is supported"
end
function __fish_print_magento_deploy_modes -d "Shows all available deploy modes"
echo developer\t"Development mode"
echo production\t"Production mode"
end
function __fish_print_magento_cache_types -d "Shows all available cache types"
echo config\t"Configuration"
echo layout\t"Layout"
echo block_html\t"Block HTML output"
echo collections\t"Collections data"
echo db_ddl\t"Database schema"
echo eav\t"Entity attribute value (EAV)"
echo full_page\t"Page cache"
echo reflection\t"Reflection"
echo translate\t"Translations"
echo config_integration\t"Integration configuration"
echo config_integration_api\t"Integration API configuration"
echo config_webservice\t"Web services configuration"
end
function __fish_print_magento_verbosity_levels -d "Shows all available verbosity levels"
echo 1\t"normal output"
echo 2\t"more verbose output"
echo 3\t"debug"
end
function __fish_print_magento_list_formats -d "Shows all available output formats"
echo txt\t"Print as plain text"
echo json\t"Print as JSON"
echo xml\t"Print as XML"
end
function __fish_print_magento_commands_list -d "Lists magento commands"
set -l commands help list admin:user:create admin:user:unlock app:config:dump cache:clean cache:disable cache:enable cache:flush cache:status catalog:images:resize catalog:product:attributes:cleanup cron:run customer:hash:upgrade deploy:mode:set deploy:mode:show dev:source-theme:deploy dev:tests:run dev:urn-catalog:generate dev:xml:convert i18n:collect-phrases i18n:pack i18n:uninstall indexer:info indexer:reindex indexer:reset indexer:set-mode indexer:show-mode indexer:status info:adminuri info:backups:list info:currency:list info:dependencies:show-framework info:dependencies:show-modules info:dependencies:show-modules-circular info:language:list info:timezone:list maintenance:allow-ips maintenance:disable maintenance:enable maintenance:status module:disable module:enable module:status module:uninstall sampledata:deploy sampledata:remove sampledata:reset setup:backup setup:config:set setup:cron:run setup:db-data:upgrade setup:db-schema:upgrade setup:db:status setup:di:compile setup:install setup:performance:generate-fixtures setup:rollback setup:static-content:deploy setup:store-config:set setup:uninstall setup:upgrade theme:uninstall
for i in $commands
echo $i
end
end
#########################################################
function __fish_magento_not_in_command -d "Checks that prompt is not inside of magento command"
set -l cmd (commandline -opc)
for i in $cmd
if contains -- $i (__fish_print_magento_commands_list)
return 1
end
end
return 0
end
#########################################################
# Perforce command is a single word that comes either as first argument
# or directly after global options.
# To test whether we're in command, it's enough that a command will appear
# in the arguments, even though if more than a single command is specified,
# p4 will complain.
function __fish_magento_is_using_command -d "Checks if prompt is in a specific command"
if contains -- $argv[1] (commandline -opc)
return 0
end
return 1
end
#########################################################
function __fish_magento_register_command -d "Adds a completion for a specific command"
complete -c magento -n "__fish_magento_not_in_command" -a $argv[1] $argv[2..-1]
end
#########################################################
function __fish_magento_register_command_option -d "Adds a specific option for a command"
complete -c magento -n "__fish_magento_is_using_command $argv[1]" $argv[2..-1]
end
#########################################################
function __fish_magento_parameter_missing -d "Checks if a parameter has been given already"
if __fish_contains_opt $argv
return 1
end
return 0
end
##################
# Global options #
##################
complete -x -c magento -s h -l help -d "Show help for a command";
complete -x -c magento -s q -l quiet -d "Do not output any message";
complete -x -c magento -s v -l verbose -a "(__fish_print_magento_verbosity_levels)" -d "Increase verbosity: 1 for normal, 2 for verbose and 3 for debug";
complete -x -c magento -o -vv;
complete -x -c magento -o vvv;
complete -x -c magento -s V -l version -d "Show version";
complete -x -c magento -l ansi -d "Force colored output";
complete -x -c magento -l no-ansi -d "Disable colored output";
complete -x -c magento -s n -l no-interaction -d "Don't ask any interactive question";
################
# Sub-Commands #
################
__fish_magento_register_command help -a "(__fish_print_magento_commands_list)" -d "Show help for a command";
__fish_magento_register_command list -d "List commands";
__fish_magento_register_command admin:user:create -x -d "Create admin account";
__fish_magento_register_command admin:user:unlock -x -d "Unlock admin account";
__fish_magento_register_command app:config:dump -d "Create application dump";
__fish_magento_register_command cache:clean -d "Clean cache types";
__fish_magento_register_command cache:disable -d "Disable cache types";
__fish_magento_register_command cache:enable -d "Enable cache types";
__fish_magento_register_command cache:flush -d "Flush cache storage used by cache types";
__fish_magento_register_command cache:status -d "Check cache status";
__fish_magento_register_command catalog:images:resize -d "Create resized product images";
__fish_magento_register_command catalog:product:attributes:cleanup -d "Remove unused product attributes";
__fish_magento_register_command cron:run -d "Run jobs by schedule";
__fish_magento_register_command customer:hash:upgrade -d "Upgrade customer's hashes according to latest algorithm";
__fish_magento_register_command deploy:mode:set -d "Set application mode";
__fish_magento_register_command deploy:mode:show -d "Show current application mode";
__fish_magento_register_command dev:source-theme:deploy -d "Collect and publish source files for theme";
__fish_magento_register_command dev:tests:run -d "Run tests";
__fish_magento_register_command dev:urn-catalog:generate -d "Generate catalog of URNs to *.xsd mappings for IDEs to highlight XML";
__fish_magento_register_command dev:xml:convert -d "Convert XML file using XSL stylesheets";
__fish_magento_register_command i18n:collect-phrases -d "Discover phrases in the codebase";
__fish_magento_register_command i18n:pack -d "Save language package";
__fish_magento_register_command i18n:uninstall -d "Uninstall language packages";
__fish_magento_register_command indexer:info -d "Show allowed indexers";
__fish_magento_register_command indexer:reindex -d "Reindex data";
__fish_magento_register_command indexer:reset -d "Reset indexer status to invalid";
__fish_magento_register_command indexer:set-mode -d "Set index mode type";
__fish_magento_register_command indexer:show-mode -d "Show index mode";
__fish_magento_register_command indexer:status -d "Show status of indexer";
__fish_magento_register_command info:adminuri -d "Show Magento Admin URI";
__fish_magento_register_command info:backups:list -d "Show available backup files";
__fish_magento_register_command info:currency:list -d "Show available currencies";
__fish_magento_register_command info:dependencies:show-framework -d "Show dependencies on Magento framework";
__fish_magento_register_command info:dependencies:show-modules -d "Show dependencies between modules";
__fish_magento_register_command info:dependencies:show-modules-circular -d "Show circular dependencies between modules";
__fish_magento_register_command info:language:list -d "Show available languages";
__fish_magento_register_command info:timezone:list -d "Show available timezones";
__fish_magento_register_command maintenance:allow-ips -d "Set maintenance mode exempt IPs";
__fish_magento_register_command maintenance:disable -d "Disable maintenance mode";
__fish_magento_register_command maintenance:enable -d "Enable maintenance mode";
__fish_magento_register_command maintenance:status -d "Show maintenance mode status";
__fish_magento_register_command module:disable -d "Disable specified modules";
__fish_magento_register_command module:enable -d "Enable specified modules";
__fish_magento_register_command module:status -d "Show status of modules";
__fish_magento_register_command module:uninstall -d "Uninstall modules installed by composer";
__fish_magento_register_command sampledata:deploy -d "Deploy sample data modules";
__fish_magento_register_command sampledata:remove -d "Remove sample data packages";
__fish_magento_register_command sampledata:reset -d "Reset sample data modules for re-installation";
__fish_magento_register_command setup:backup -d "Take backup of application code base, media and database";
__fish_magento_register_command setup:config:set -d "Create or modifies the deployment configuration";
__fish_magento_register_command setup:cron:run -d "Run cron job scheduled for setup application";
__fish_magento_register_command setup:db-data:upgrade -d "Install and upgrades data in the DB";
__fish_magento_register_command setup:db-schema:upgrade -d "Install and upgrade the DB schema";
__fish_magento_register_command setup:db:status -d "Check if DB schema or data requires upgrade";
__fish_magento_register_command setup:di:compile -d "Generate DI configuration and all missing classes that can be auto-generated";
__fish_magento_register_command setup:install -d "Install Magento application";
__fish_magento_register_command setup:performance:generate-fixtures -d "Generate fixtures";
__fish_magento_register_command setup:rollback -d "Roll back Magento Application codebase, media and database";
__fish_magento_register_command setup:static-content:deploy -d "Deploy static view files";
__fish_magento_register_command setup:store-config:set -d "Install store configuration";
__fish_magento_register_command setup:uninstall -d "Uninstall Magento application";
__fish_magento_register_command setup:upgrade -d "Upgrade Magento application, DB data, and schema";
__fish_magento_register_command theme:uninstall -d "Uninstall theme";
#
# help
#
__fish_magento_register_command_option help -x -a "(__fish_print_magento_commands_list)" -d "Show help for a command";
#
# list
#
__fish_magento_register_command_option list -f -l xml -d "Output as XML";
__fish_magento_register_command_option list -f -l raw -d "Output as plaintext";
__fish_magento_register_command_option list -f -l format -a "(__fish_print_magento_list_formats)" -d "Output other formats (default: txt)";
#
# admin:user:create
#
__fish_magento_register_command_option admin:user:create -n "__fish_magento_parameter_missing admin-user" -f -a "--admin-user" -d "(Required) Admin user";
__fish_magento_register_command_option admin:user:create -n "__fish_magento_parameter_missing admin-password" -f -a "--admin-password" -d "(Required) Admin password";
__fish_magento_register_command_option admin:user:create -n "__fish_magento_parameter_missing admin-email" -f -a "--admin-email" -d "(Required) Admin email";
__fish_magento_register_command_option admin:user:create -n "__fish_magento_parameter_missing admin-firstname" -f -a "--admin-firstname" -d "(Required) Admin first name";
__fish_magento_register_command_option admin:user:create -n "__fish_magento_parameter_missing admin-lastname" -f -a "--admin-lastname" -d "(Required) Admin last name";
__fish_magento_register_command_option admin:user:create -f -r -l admin-user -d "(Required) Admin user";
__fish_magento_register_command_option admin:user:create -f -r -l admin-password -d "(Required) Admin password";
__fish_magento_register_command_option admin:user:create -f -r -l admin-email "-d "(Required) Admin email";
__fish_magento_register_command_option admin:user:create -f -r -l admin-firstname -d "(Required) Admin first name";
__fish_magento_register_command_option admin:user:create -f -r -l admin-lastname -d "(Required) Admin last name";
__fish_magento_register_command_option admin:user:create -f -l magento-init-params -d "Add to any command to customize Magento initialization parameters";
#
# admin:user:unlock
#
__fish_magento_register_command_option admin:user:unlock -f -d "Admin user to unlock";
#
# cache:clean
#
__fish_magento_register_command_option cache:clean -f -a "(__fish_print_magento_cache_types)" -d "Space-separated list of cache types or omit for all";
__fish_magento_register_command_option cache:clean -f -l bootstrap -d "Add or override parameters of the bootstrap";
#
# cache:enable
#
__fish_magento_register_command_option cache:enable -f -a "(__fish_print_magento_cache_types)" -d "Space-separated list of cache types or omit for all";
__fish_magento_register_command_option cache:enable -f -l bootstrap -d "Add or override parameters of the bootstrap";
#
# cache:disable
#
__fish_magento_register_command_option cache:disable -f -a "(__fish_print_magento_cache_types)" -d "Space-separated list of cache types or omit for all";
__fish_magento_register_command_option cache:disable -f -l bootstrap -d "Add or override parameters of the bootstrap";
#
# cache:status
#
__fish_magento_register_command_option cache:status -f -l bootstrap -d "Add or override parameters of the bootstrap";
#
# cron:run
#
__fish_magento_register_command_option cron:run -f -l group -d "Run jobs only from specified group";
__fish_magento_register_command_option cron:run -f -l bootstrap -d "Add or override parameters of the bootstrap";
#
# deploy:mode:set
#
__fish_magento_register_command_option deploy:mode:set -f -a "(__fish_print_magento_deploy_modes)" -d 'Application mode to set. Available are "developer" or "production"';
__fish_magento_register_command_option deploy:mode:set -f -s s -l skip-compilation -d "Skip clearing and regeneration of static content (generated code, preprocessed CSS, and assets in pub/static/)";
#
# dev:source-theme:deploy
#
__fish_magento_register_command_option dev:source-theme:deploy -d 'Files to pre-process (file should be specified without extension) (default: "css/styles-m","css/styles-l")';
__fish_magento_register_command_option dev:source-theme:deploy -f -l type -a "(__fish_print_magento_source_theme_file_types)" -d 'Type of source files (default: "less")';
__fish_magento_register_command_option dev:source-theme:deploy -f -l locale -a "(__fish_print_magento_languages)" -d 'Locale (default: "en_US")';
__fish_magento_register_command_option dev:source-theme:deploy -f -l area -a "(__fish_print_magento_theme_areas)" -d 'Area (default: "frontend")';
__fish_magento_register_command_option dev:source-theme:deploy -l theme -d 'Theme [Vendor/theme] (default: "Magento/luma")';
#
# dev:tests:run
#
__fish_magento_register_command_option dev:tests:run -f -a "(__fish_print_magento_available_tests)" -d 'Type of test to run (default: "default")';
#
# dev:urn-catalog:generate
#
__fish_magento_register_command_option dev:urn-catalog:generate -f -l ide -a "(__fish_print_magento_available_ides)" -d 'Catalog generation format. Supported: [phpstorm] (default: "phpstorm")';
#
# dev:xml:convert
#
__fish_magento_register_command_option dev:xml:convert -s o -l overwrite -d 'Overwrite XML file';
#
# i18n:collect-phrases
#
__fish_magento_register_command_option i18n:collect-phrases -s o -l output -d 'Path (including filename) to an output file. With no file specified, defaults to stdout';
__fish_magento_register_command_option i18n:collect-phrases -f -s m -l magento -d 'Use --magento to parse current Magento codebase. Omit parameter if a directory is specified';
#
# i18n:pack
#
__fish_magento_register_command_option i18n:pack -f -s m -l mode -a "(__fish_print_magento_i18n_packing_modes)" -d 'Save mode for dictionary (default: "replace")';
__fish_magento_register_command_option i18n:pack -s d -l allow-duplicates -d 'Use --allow-duplicates to allow saving duplicates of translate. Otherwise omit parameter';
#
# i18n:uninstall
#
__fish_magento_register_command_option i18n:uninstall -f -s b -l backup-code -d 'Take code and configuration files backup (excluding temporary files)';
__fish_magento_register_command_option i18n:uninstall -f -a "(__fish_print_magento_languages)" -d 'Language package name';
#
# info:dependencies:show-framework
#
__fish_magento_register_command_option info:dependencies:show-framework -f -s o -l output -d 'Report filename (default: "framework-dependencies.csv")';
#
# info:dependencies:show-modules
#
__fish_magento_register_command_option info:dependencies:show-modules -f -s o -l output -d 'Report filename (default: "modules-dependencies.csv")';
#
# info:dependencies:show-modules-circular
#
__fish_magento_register_command_option info:dependencies:show-modules-circular -f -s o -l output -d 'Report filename (default: "modules-circular-dependencies.csv")';
#
# maintenance:allow-ips
#
__fish_magento_register_command_option maintenance:allow-ips -l none -d 'Clear allowed IP addresses';
#
# maintenance:disable
#
__fish_magento_register_command_option maintenance:disable -l ip -d "Allowed IP addresses (use 'none' to clear list)";
#
# maintenance:enable
#
__fish_magento_register_command_option maintenance:enable -l ip -d "Allowed IP addresses (use 'none' to clear list)";
#
# module:disable
#
__fish_magento_register_command_option module:disable -f -a "(__fish_print_magento_modules)" -d "Module name";
__fish_magento_register_command_option module:disable -s f -l force -d "Bypass dependencies check";
__fish_magento_register_command_option module:disable -l all -d "Disable all modules";
__fish_magento_register_command_option module:disable -s c -l clear-static-content -d "Clear generated static view files. Necessary if module(s) have static view files";
#
# module:enable
#
__fish_magento_register_command_option module:enable -f -a "(__fish_print_magento_modules)" -d "Module name";
__fish_magento_register_command_option module:enable -f -s f -l force -d "Bypass dependencies check";
__fish_magento_register_command_option module:enable -f -l all -d "Enable all modules";
__fish_magento_register_command_option module:enable -f -s c -l clear-static-content -d "Clear generated static view files. Necessary if module(s) have static view files";
#
# module:uninstall
#
__fish_magento_register_command_option module:uninstall -f -a "(__fish_print_magento_modules)" -d "Module name";
__fish_magento_register_command_option module:uninstall -f -s r -l remove-data -d "Remove data installed by module(s)";
__fish_magento_register_command_option module:uninstall -f -l backup-code -d "Take code and configuration files backup (excluding temporary files)";
__fish_magento_register_command_option module:uninstall -f -l backup-media -d "Take media backup";
__fish_magento_register_command_option module:uninstall -f -l backup-db -d "Take complete database backup";
__fish_magento_register_command_option module:uninstall -f -s c -l clear-static-content -d "Clear generated static view files. Necessary if module(s) have static view files";
#
# setup:backup
#
__fish_magento_register_command_option setup:backup -f -l code -d "Take code and configuration files backup (excluding temporary files)";
__fish_magento_register_command_option setup:backup -f -l media -d "Take media backup";
__fish_magento_register_command_option setup:backup -f -l db -d "Take complete database backup";
#
# setup:config:set
#
__fish_magento_register_command_option setup:config:set -f -l backend-frontname -d "Backend frontname (will be autogenerated if missing)";
__fish_magento_register_command_option setup:config:set -f -l key -d "Encryption key";
__fish_magento_register_command_option setup:config:set -f -l session-save -d "Session save handler";
__fish_magento_register_command_option setup:config:set -f -l definition-format -d "Type of definitions used by Object Manager"
__fish_magento_register_command_option setup:config:set -f -l db-host -d "Database server host";
__fish_magento_register_command_option setup:config:set -f -l db-name -d "Database name";
__fish_magento_register_command_option setup:config:set -f -l db-user -d "Database server username";
__fish_magento_register_command_option setup:config:set -f -l db-engine -d "Database server engine" -a "(__fish_print_magento_mysql_engines)";
__fish_magento_register_command_option setup:config:set -f -l db-password -d "Database server password";
__fish_magento_register_command_option setup:config:set -f -l db-prefix -d "Database table prefix";
__fish_magento_register_command_option setup:config:set -f -l db-model -d "Database type";
__fish_magento_register_command_option setup:config:set -f -l db-init-statements -d "Database initial set of commands";
__fish_magento_register_command_option setup:config:set -f -l skip-db-validation -s s -d "If specified, then db connection validation will be skipped";
__fish_magento_register_command_option setup:config:set -f -l http-cache-hosts -d "HTTP cache hosts";
#
# setup:install
#
__fish_magento_register_command_option setup:install -n "__fish_magento_parameter_missing admin-user" -f -a "--admin-user" -d "(Required) Admin user";
__fish_magento_register_command_option setup:install -n "__fish_magento_parameter_missing admin-password" -f -a "--admin-password" -d "(Required) Admin password";
__fish_magento_register_command_option setup:install -n "__fish_magento_parameter_missing admin-email" -f -a "--admin-email" -d "(Required) Admin email";
__fish_magento_register_command_option setup:install -n "__fish_magento_parameter_missing admin-firstname" -f -a "--admin-firstname" -d "(Required) Admin first name";
__fish_magento_register_command_option setup:install -n "__fish_magento_parameter_missing admin-lastname" -f -a "--admin-lastname" -d "(Required) Admin last name";
__fish_magento_register_command_option setup:install -f -l backend-frontname -d "Backend frontname (will be autogenerated if missing)";
__fish_magento_register_command_option setup:install -f -l key -d "Encryption key";
__fish_magento_register_command_option setup:install -f -l session-save -d "Session save handler";
__fish_magento_register_command_option setup:install -f -l definition-format -d "Type of definitions used by Object Manager"
__fish_magento_register_command_option setup:install -f -l db-host -d "Database server host";
__fish_magento_register_command_option setup:install -f -l db-name -d "Database name";
__fish_magento_register_command_option setup:install -f -l db-user -d "Database server username";
__fish_magento_register_command_option setup:install -f -l db-engine -d "Database server engine" -a "(__fish_print_magento_mysql_engines)";
__fish_magento_register_command_option setup:install -f -l db-password -d "Database server password";
__fish_magento_register_command_option setup:install -f -l db-prefix -d "Database table prefix";
__fish_magento_register_command_option setup:install -f -l db-model -d "Database type";
__fish_magento_register_command_option setup:install -f -l db-init-statements -d "Database initial set of commands";
__fish_magento_register_command_option setup:install -f -l skip-db-validation -s s -d "Skip database connection validation";
__fish_magento_register_command_option setup:install -f -l http-cache-hosts -d "HTTP cache hosts";
__fish_magento_register_command_option setup:install -f -l base-url -a "(__fish_print_magento_url_protocols)" -d "URL the store is supposed to be available at";
__fish_magento_register_command_option setup:install -f -l language -a "(__fish_print_magento_languages)" -d "Default language code";
__fish_magento_register_command_option setup:install -f -l timezone -d "Default time zone code";
__fish_magento_register_command_option setup:install -f -l currency -d "Default currency code";
__fish_magento_register_command_option setup:install -f -l use-rewrites -d "Use rewrites";
__fish_magento_register_command_option setup:install -f -l use-secure -d "Use secure URLs. Enable only if SSL is available";
__fish_magento_register_command_option setup:install -f -l base-url-secure -a "https://" -d "Base URL for SSL connection";
__fish_magento_register_command_option setup:install -f -l use-secure-admin -d "Run admin interface with SSL";
__fish_magento_register_command_option setup:install -f -l admin-use-security-key -d 'Use security key in admin urls/forms';
__fish_magento_register_command_option setup:install -f -r -l admin-user -d "(Required) Admin user";
__fish_magento_register_command_option setup:install -f -r -l admin-password -d "(Required) Admin password";
__fish_magento_register_command_option setup:install -f -r -l admin-email -d "(Required) Admin email";
__fish_magento_register_command_option setup:install -f -r -l admin-firstname -d "(Required) Admin first name";
__fish_magento_register_command_option setup:install -f -r -l admin-lastname -d "(Required) Admin last name";
__fish_magento_register_command_option setup:install -f -l cleanup-database -d "Cleanup database before installation";
__fish_magento_register_command_option setup:install -f -l sales-order-increment-prefix -d "Sales order number prefix";
__fish_magento_register_command_option setup:install -f -l use-sample-data -d "Use sample data";
#
# setup:performance:generate-fixtures
#
__fish_magento_register_command_option setup:performance:generate-fixtures -f -s s -l skip-reindex -d "Skip reindex";
#
# setup:rollback
#
__fish_magento_register_command_option setup:rollback -s c -l code-file -d "Basename of the code backup file in var/backups";
__fish_magento_register_command_option setup:rollback -s m -l media-file -d "Basename of the media backup file in var/backups";
__fish_magento_register_command_option setup:rollback -s d -l db-file -d "Basename of the db backup file in var/backups";
#
# setup:static-content:deploy
#
__fish_magento_register_command_option setup:static-content:deploy -x -a "(__fish_print_magento_languages)" -d "Space-separated list of ISO-636 language codes to output static view files for";
__fish_magento_register_command_option setup:static-content:deploy -f -s d -l dry-run -d "Simulate deployment only";
__fish_magento_register_command_option setup:static-content:deploy -f -l no-javascript -d "Don't deploy JavaScript files";
__fish_magento_register_command_option setup:static-content:deploy -f -l no-css -d "Don't deploy CSS files";
__fish_magento_register_command_option setup:static-content:deploy -f -l no-less -d "Don't deploy LESS files"
__fish_magento_register_command_option setup:static-content:deploy -f -l no-images -d "Don't deploy images";
__fish_magento_register_command_option setup:static-content:deploy -f -l no-fonts -d "Don't deploy font files"
__fish_magento_register_command_option setup:static-content:deploy -f -l no-html -d "Don't deploy HTML files"
__fish_magento_register_command_option setup:static-content:deploy -f -l no-misc -d "Don't deploy other types of files (.md, .jbf, .csv, etc...)";
__fish_magento_register_command_option setup:static-content:deploy -f -l no-html-minify -d "Don't minify HTML files";
__fish_magento_register_command_option setup:static-content:deploy -s t -l theme -d 'Generate static view files only for specified themes (default: "all")';
__fish_magento_register_command_option setup:static-content:deploy -l exclude-theme -d 'Do not generate files for specified themes (default: "none")';
__fish_magento_register_command_option setup:static-content:deploy -f -s l -l language -a "(__fish_print_magento_languages)" -d 'Generate files only for specified languages (default: "all")';
__fish_magento_register_command_option setup:static-content:deploy -f -l exclude-language -d 'Do not generate files for specified languages. (default: "none") (multiple values allowed)';
__fish_magento_register_command_option setup:static-content:deploy -f -s a -l area -a "(__fish_print_magento_theme_areas)" -d 'Generate files only for specified areas (default: "all")';
__fish_magento_register_command_option setup:static-content:deploy -f -l exclude-area -a "(__fish_print_magento_theme_areas)" -d 'Do not generate files for specified areas (default: "none")';
__fish_magento_register_command_option setup:static-content:deploy -x -s j -l jobs -d "Enable parallel processing using specified number of jobs (default: 4)";
__fish_magento_register_command_option setup:static-content:deploy -f -l symlink-locale -d "Create symlinks for files of locales which are passed for deployment but have no customizations";
#
# setup:store-config:set
#
__fish_magento_register_command_option setup:store-config:set -f -l base-url -a "(__fish_print_magento_url_protocols)" -d "URL the store is supposed to be available at";
__fish_magento_register_command_option setup:store-config:set -f -l language -a "(__fish_print_magento_languages)" -d "Default language code";
__fish_magento_register_command_option setup:store-config:set -f -l timezone -d "Default time zone code";
__fish_magento_register_command_option setup:store-config:set -f -l currency -d "Default currency code";
__fish_magento_register_command_option setup:store-config:set -f -l use-rewrites -d "Use rewrites";
__fish_magento_register_command_option setup:store-config:set -f -l use-secure -d "Use secure URLs. Only enable if SSL is available";
__fish_magento_register_command_option setup:store-config:set -f -l base-url-secure -a "https://" -d "Base URL for SSL connection";
__fish_magento_register_command_option setup:store-config:set -f -l use-secure-admin -d "Run admin interface with SSL";
__fish_magento_register_command_option setup:store-config:set -f -l admin-use-security-key -d 'Use security key in admin urls/forms';
#
# setup:upgrade
#
__fish_magento_register_command_option setup:upgrade -l keep-generated -d "Prevents generated files from being deleted";
#
# theme:uninstall
#
__fish_magento_register_command_option theme:uninstall -f -l backup-code -d "Take code backup (excluding temporary files)";
__fish_magento_register_command_option theme:uninstall -f -s c -l clear-static-content -d "Clear generated static view files";

View File

@@ -242,7 +242,7 @@ function __fish_config_interactive -d "Initializations that should be performed
end
# Disable BP before every command because that might not support it.
function __fish_disable_bracketed_paste --on-event fish_preexec
function __fish_disable_bracketed_paste --on-event fish_preexec --on-process-exit %self
printf "\e[?2004l"
end

View File

@@ -40,10 +40,14 @@ function __fish_print_help --description "Print help message for the specified f
set rLL -rLL=$cols[1]n
end
set -lx GROFF_TMAC_PATH $__fish_datadir/groff
set -l mfish
if test -e $GROFF_TMAC_PATH/fish.tmac
set mfish -mfish
end
if test -e "$__fish_datadir/man/man1/$item.1"
set help (nroff -c -man -mfish -t $rLL "$__fish_datadir/man/man1/$item.1" ^/dev/null)
set help (nroff -c -man $mfish -t $rLL "$__fish_datadir/man/man1/$item.1" ^/dev/null)
else if test -e "$__fish_datadir/man/man1/$item.1.gz"
set help (gunzip -c "$__fish_datadir/man/man1/$item.1.gz" ^/dev/null | nroff -c -man -mfish -t $rLL ^/dev/null)
set help (gunzip -c "$__fish_datadir/man/man1/$item.1.gz" ^/dev/null | nroff -c -man $mfish -t $rLL ^/dev/null)
end
# The original implementation trimmed off the top 5 lines and bottom 3 lines

View File

@@ -18,7 +18,7 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
end
# Check hosts known to ssh
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/known_hosts{,2} # Yes, seriously - the default specifies both with and without "2"
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/{,ssh_}known_hosts{,2} # Yes, seriously - the default specifies both with and without "2"
# Check default ssh configs
set -l ssh_config
# Get alias and commandline options

View File

@@ -71,7 +71,7 @@ function help --description 'Show help for the fish shell'
end
end
if not set -q fish_browser
if not set -q fish_browser[1]
printf (_ '%s: Could not find a web browser.\n') help
printf (_ 'Please set the variable $BROWSER or fish_help_browser and try again.\n\n')
return 1
@@ -131,7 +131,8 @@ function help --description 'Show help for the fish shell'
# OS X /usr/bin/open swallows fragments (anchors), so use osascript
# Eval is just a cheesy way of removing the hash escaping
if test "$fish_browser" = osascript
osascript -e 'open location "'(eval echo $page_url)'"'
set -l opencmd 'open location "'(eval echo $page_url)'"'
osascript -e 'try' -e $opencmd -e 'on error' -e $opencmd -e 'end try'
return
end

View File

@@ -102,7 +102,7 @@ function type --description 'Print the type of a command'
set paths (command -s -- $i)
else
# TODO: This should really be `command -sa`.
for file in $PATH/*
for file in $PATH/$i
test -x $file -a ! -d $file
and set paths $paths $file
end

View File

@@ -560,7 +560,6 @@ static int builtin_bind(parser_t &parser, io_streams_t &streams, wchar_t **argv)
argv[0], eseq.c_str());
}
}
break;
} else {
if (builtin_bind_add(argv[w.woptind], argv + (w.woptind + 1),
argc - (w.woptind + 1), bind_mode, sets_bind_mode,

View File

@@ -1207,14 +1207,12 @@ bool completer_t::try_complete_user(const wcstring &str) {
wcstring desc = format_string(COMPLETE_USER_DESC, pw_name);
append_completion(&this->completions, &pw_name[name_len], desc, COMPLETE_NO_SPACE);
result = true;
break;
} else if (wcsncasecmp(user_name, pw_name, name_len) == 0) {
wcstring name = format_string(L"~%ls", pw_name);
wcstring desc = format_string(COMPLETE_USER_DESC, pw_name);
append_completion(&this->completions, name, desc,
COMPLETE_REPLACES_TOKEN | COMPLETE_DONT_ESCAPE | COMPLETE_NO_SPACE);
result = true;
break;
}
// If we've spent too much time (more than 200 ms) doing this give up.

View File

@@ -3139,8 +3139,13 @@ void history_tests_t::test_history_formats(void) {
} else {
// The results are in the reverse order that they appear in the bash history file.
// We don't expect whitespace to be elided.
const wchar_t *expected[] = {L"sleep 123", L" final line", L"echo supsup",
L"history --help", L"echo foo", NULL};
const wchar_t *expected[] = {L"sleep 123",
L" final line",
L"echo supsup",
L"export XVAR='exported'",
L"history --help",
L"echo foo",
NULL};
history_t &test_history = history_t::history_with_name(L"bash_import");
test_history.populate_from_bash(f);
if (!history_equals(test_history, expected)) {

View File

@@ -36,6 +36,7 @@
#include "lru.h"
#include "parse_constants.h"
#include "parse_tree.h"
#include "parse_util.h"
#include "path.h"
#include "reader.h"
#include "signal.h"
@@ -1677,21 +1678,30 @@ void history_t::populate_from_config_path() {
static bool should_import_bash_history_line(const std::string &line) {
if (line.empty()) return false;
// Very naive tests! Skip `export` and comments.
// TODO: We should probably should skip other commands.
const char *const ignore_prefixes[] = {"export ", "#"};
parse_node_tree_t parse_tree;
wcstring wide_line = str2wcstring(line);
if (!parse_tree_from_string(wide_line, parse_flag_none, &parse_tree, NULL)) return false;
for (size_t i = 0; i < sizeof ignore_prefixes / sizeof *ignore_prefixes; i++) {
const char *prefix = ignore_prefixes[i];
if (!line.compare(0, strlen(prefix), prefix)) {
return false;
}
}
// In doing this test do not allow incomplete strings. Hence the "false" argument.
parse_error_list_t errors;
parse_util_detect_errors(wide_line, &errors, false);
if (!errors.empty()) return false;
// The following are Very naive tests!
// Skip comments.
if (line[0] == '#') return false;
// Skip lines with backticks.
if (line.find('`') != std::string::npos) return false;
// Skip lines that end with a backslash since we do not handle multiline commands from bash.
// Skip lines with [[...]] and ((...)) since we don't handle those constructs.
if (line.find("[[") != std::string::npos) return false;
if (line.find("]]") != std::string::npos) return false;
if (line.find("((") != std::string::npos) return false;
if (line.find("))") != std::string::npos) return false;
// Skip lines that end with a backslash. We do not handle multiline commands from bash history.
if (line.back() == '\\') return false;
return true;

View File

@@ -38,8 +38,8 @@ class lru_cache_t {
lru_node_t &operator=(const lru_node_t &) = delete;
lru_node_t(lru_node_t &&) = default;
// Our location in the map!
node_iter_t iter;
// Our key in the map. This is owned by the map itself.
const wcstring *key;
// The value from the client
CONTENTS value;
@@ -78,21 +78,23 @@ class lru_cache_t {
// Remove the node
void evict_node(lru_node_t *node) {
assert(node != &mouth);
// We should never evict the mouth.
assert(node != NULL && node->iter != this->node_map.end());
assert(node != &mouth && node != NULL && node->key != NULL);
auto iter = this->node_map.find(*node->key);
assert(iter != this->node_map.end());
// Remove it from the linked list.
node->prev->next = node->next;
node->next->prev = node->prev;
// Pull out our key and value
wcstring key = std::move(node->iter->first);
// Note we copy the key in case the map needs it to erase the node
wcstring key = *node->key;
CONTENTS value(std::move(node->value));
// Remove us from the map. This deallocates node!
node_map.erase(node->iter);
node_map.erase(iter);
// Tell ourselves what we did
DERIVED *dthis = static_cast<DERIVED *>(this);
@@ -228,7 +230,7 @@ class lru_cache_t {
// Tell the node where it is in the map
node_iter_t iter = iter_inserted.first;
lru_node_t *node = &iter->second;
node->iter = iter;
node->key = &iter->first;
node->next = mouth.next;
node->next->prev = node;
@@ -285,8 +287,7 @@ class lru_cache_t {
bool operator!=(const iterator &other) { return !(*this == other); }
value_type operator*() const {
const lru_node_t *dnode = static_cast<const lru_node_t *>(node);
const wcstring &key = dnode->iter->first;
return {key, dnode->value};
return {*dnode->key, dnode->value};
}
};

View File

@@ -1781,22 +1781,14 @@ static void handle_token_history(int forward, int reset) {
tokenizer_t tok(data->token_history_buff.c_str(), TOK_ACCEPT_UNFINISHED);
tok_t token;
while (tok.next(&token)) {
if (token.type == TOK_STRING) {
if (token.text.find(data->search_buff) != wcstring::npos) {
// debug( 3, L"Found token at pos %d\n", tok_get_pos( &tok ) );
if (token.offset >= current_pos) {
break;
}
// debug( 3, L"ok pos" );
if (token.type != TOK_STRING) continue;
if (token.text.find(data->search_buff) == wcstring::npos) continue;
if (token.offset >= current_pos) continue;
if (find(data->search_prev.begin(), data->search_prev.end(), token.text) ==
data->search_prev.end()) {
data->token_history_pos = token.offset;
str = token.text;
}
}
} else {
break;
auto found = find(data->search_prev.begin(), data->search_prev.end(), token.text);
if (found == data->search_prev.end()) {
data->token_history_pos = token.offset;
str = token.text;
}
}
}

View File

@@ -87,15 +87,22 @@ bool wreaddir_resolving(DIR *dir, const wcstring &dir_path, wcstring &out_name,
}
bool wreaddir(DIR *dir, wcstring &out_name) {
struct dirent d;
// We need to use a union to ensure that the dirent struct is large enough to avoid stomping on
// the stack. Some platforms incorrectly defined the `d_name[]` member as being one element
// long when it should be at least NAME_MAX + 1.
union {
struct dirent d;
char c[offsetof(struct dirent, d_name) + NAME_MAX + 1]; /* NAME_MAX is POSIX. */
} d_u;
struct dirent *result = NULL;
int retval = readdir_r(dir, &d, &result);
int retval = readdir_r(dir, &d_u.d, &result);
if (retval || !result) {
out_name = L"";
return false;
}
out_name = str2wcstring(d.d_name);
out_name = str2wcstring(d_u.d.d_name);
return true;
}

View File

@@ -1,7 +1,7 @@
echo foo
history --help
#1339718290
export HISTTIMEFORMAT='%F %T '
export XVAR='exported'
#1339718298
echo supsup
#abcde
@@ -11,4 +11,9 @@ echo hello \
final line
another `command
and arg` to skip
backticks `are not allowed`
a && echo invalid construct
[[ x = y ]] && echo double brackets not allowed
(( 1 = 2 )) && echo double parens not allowed
posix_cmd_sub $(is not supported)
sleep 123