summaryrefslogtreecommitdiff
path: root/lib/functions.zsh
AgeCommit message (Collapse)Author
2023-05-23fix(functions): use `command` envCarlo Sala
Closes #11709
2023-03-03fix(lib): use `$BROWSER` in `open_command` if set (#11532)Marc Cornellà
Fixes #11098
2023-01-20feat(functions/take): make `.tgz` behave as `.tar.gz` (#11446)Joan Marcè i Igual
2022-05-15fix(lib): encode all arguments besides the first in `omz_urlencode`Marc Cornellà
Fixes https://github.com/ohmyzsh/ohmyzsh/commit/140c977a3d82410f48c198596de193d2d6b7b9b5#commitcomment-73688165
2021-11-11fix(lib): fix `omz_urldecode` unsafe eval bugMarc Cornellà
The `omz_urldecode` function uses an eval to decode the input which can be exploited to inject commands. This is used only in the svn plugin and it requires a complex process to exploit, so it is highly unlikely to have been used by an attacker.
2021-11-09style: use `-n` flag in `head` and `tail` commands (#10391)Kevin Burke
Co-authored-by: Marc Cornellà <hello@mcornella.com>
2021-08-10refactor(lib): refactor take functionsMarc Cornellà
2021-08-10feat(lib): add `mkcd` as equivalent to `takedir` (#9749)Marc Cornellà
Fixes #9749
2021-06-11feat(take): add support to `take' for taking remote urls (#2029)Mitchel Humpherys
Download, extract, and cd into the resulting directory. Co-authored-by: Mitchel Humpherys <mitchelh@codeaurora.org>
2021-01-16fix(lib): use -N syntax in `head` and `tail` to support Solaris (#6391)Marc Cornellà
Closes #6391 Co-authored-by: Sergey Mashkov <cy6erGn0m@gmail.com>
2020-12-07feat(lib)!: soft-deprecate `upgrade_oh_my_zsh` function for everybodyMarc Cornellà
BREAKING CHANGE: the `upgrade_oh_my_zsh` function now calls `omz update` directly.
2020-12-07fix(updater): don't show changelog when running unattended update (#9495)Marc Cornellà
Fixes #9495
2020-11-30fix(updater): correctly restart the zsh session when the update pulled changesMarc Cornellà
2020-11-30refactor(updater): switch to Zsh execution and fix git remote detection logicMarc Cornellà
2020-11-09fix(lib): make opts local in omz_urlencode to fix scoping bugMarc Cornellà
Fixes error message when using zplug, due to $opts having been declared as an associative array: omz_urlencode:2: bad set of key/value pairs for associative array Fixes #9429
2020-09-26lib: clean up zsh_stats functionMarc Cornellà
2020-08-18Remove zsh session restart on omz update and upgrade_oh_my_zshMarc Cornellà
2020-08-17Fix upgrade_oh_my_zsh function deprecationMarc Cornellà
2020-08-04cli: add update command (#9094)Dario Vladović
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-04-05lib: speed up slow parts of the lib files; other small fixesMarc Cornellà
2020-03-03lib: use `command` to run rm in upgrade function (#8696)Marek Dědič
2020-02-24lib: delete upgrade lock in upgrade_oh_my_zshMarc Cornellà
Provides a different solution to #8332 and #8333
2019-09-19Fix WSL check for WSL 2 and simplify nohup in open_commandMarc Cornellà
WSL 2 changes the output of `uname -r`. For instance, WSL 1: 4.4.0-18980-Microsoft WSL 2: 4.19.67-microsoft-standard Since WSL 2 lowercases the M, we can match for the rest of the string which remains lowercase throughout both versions. Another option would be to match for both upper- and lower-case Ms, like that: $(uname -r) = *[Mm]icrosoft* Fixed use of nohup in open_command where it was only necessary for xdg-open (and actually harmful for cmd.exe in WSL 2). The current logic is simpler and more future-proof.
2019-02-25lib: optimize default and env_defaultMarc Cornellà
2018-08-09core: fix alias_value functionMarc Cornellà
Fixes #5835
2018-07-02Enable passing multiple directories to take (#6900)sam-lunt
* enable passing multiple directories to take * Update take function Do not call cd if mkdir fails
2018-06-30open_command: fix and improve command for WSLMarc Cornellà
- Add double quotes to command so that the next argument isn't interpreted as the title for the start command. - If the first argument is a valid path, convert it to Windows path notation. If `wslpath` fails—because it's a path from inside WSL, which cannot be converted to Windows path notation— fail with an error code. This last circumstance will show an error like so: wslpath: path: Result not representable
2018-06-30open_command: simplify codeMarc Cornellà
2018-04-24Check for Microsoft's WSL in open_command (#6751)Marc Cornellà
This will work only on files and directories in a DrvFs mount, i.e. that can be translated to a Windows drive path. For example: /mnt/c/Users/user. Files and folders inside the LXSS directory can't be handled in Windows, they must be ONLY used by the WSL subsystem. That's why you won't be able to open your $HOME directory, for instance. See https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
2016-12-30 'lib/functions.zsh: Solve typos'Patrick José Pereira
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2016-08-09Replace /bin/sh with sh for portability (#5291)Fredrik Fornwall
This makes things work even on system lacking /bin/sh, such as on non-rooted Android systems.
2015-11-30Use shwordsplit in open_command()Marc Cornellà
2015-11-30Add empty string parameter to start commandMarc Cornellà
Otherwise `start` will confuse the first parameter as the title of a new command prompt if the parameter contains whitespace. That is because the command to be run will be: start "abc def" which opens a new command prompt window with the title "abc def". With the added empty string we force the start command to interpret the passed parameter as the file / command: start "" "abc def" which will be interpreted like `""` is the title and the rest is the file or command to start. ------- **NOTE:** this wouldn't be necessary if the start script in msys was defined differently; that is, if it had the empty string already incorporated in the script (/usr/bin/start), like so: ```diff -cmd //c start "${@//&/^&}" +cmd //c start "" "${@//&/^&}" ``` Notice however that this would make it impossible to use start setting a different title, so it's probably best to leave it as is. More info: http://sourceforge.net/p/msys2/tickets/14/ ------- The change `${(z)open_cmd}` is necessary to force zsh to split the variable by the spaces and interpret it as separate words. More info: http://zsh.sourceforge.net/FAQ/zshfaq03.html#l17
2015-11-30make this work in the git-for-windows SDKMark Ingalls
Added an option for the msys value of $OSTYPE
2015-11-29Fix open_command nohup callMarc Cornellà
There a syntax error if $cmd_var contains more than one word, so we drop the current way to prepend nohup and use a simpler if-else form.
2015-11-27termsupport: protect subshell with quotesAndrew Janke
2015-11-27Drop the use of nohup on OSX for tmux compatibilityMarc Cornellà
Apparently `nohup` is not needed in OSX, and using it has the side that it may break under tmux with the error nohup: can't detach from console: No such file or directory For now, this commit only drops the use of `nohup` in OSX. But it *may* not be necessary under other similar platforms.
2015-08-17Merge branch 'master' into fold-terminalapp-plugin-into-termsupportAndrew Janke
2015-08-17Add a deprecation comment.Andrew Janke
2015-08-09Move urlencode/urldecode functions to core libAndrew Janke
2015-08-05Implement cross-platform open function open_command()Marc Cornellà
For now this supports: - Mac OS X - Linux (presumably works on all versions) - Cygwin (Windows)
2014-08-20Replace /usr/bin/env with envFredrik Fornwall
Some environments (such as Android) does not have /usr/bin.
2014-02-06`fc -l 1` instead of `history` in zsh_stats #2501Huang, Tao
$HIST_STAMP breaks zsh_stats. see #2501
2013-12-02Merge pull request #1134 from koraa/pull_req_helpersRobby Russell
Helpers for default variables and alias value access
2012-11-14Improved statistics functions, effect:CHH
1 1124 24.6006% c 2 985 21.5583% git 3 343 7.50711% rails 4 328 7.17881% cd 5 314 6.8724% rspec 6 257 5.62486% la 7 197 4.31167% rake 8 154 3.37054% s 9 109 2.38564% .. 10 95 2.07923% rvm 11 68 1.48829% guard 12 36 0.787919% bundle 13 29 0.634712% ssh 14 28 0.612826% pry 15 27 0.590939% open 16 26 0.569052% middleman 17 26 0.569052% gem 18 24 0.525279% rm 19 24 0.525279% heroku 20 23 0.503392% nvm
2012-05-29Add helper to easily define default values for variables and env variables.mapc
2012-05-29Add helper to get the value of an alias onlymapc
2011-12-25Fix upgrade and uninstall functions to pick up $ZSH valueIndrajit Raychaudhuri
2011-06-01Added extract plugin.Sorin Ionescu
2011-05-26Merge pull request #196 from asymmetric/masterRobby Russell
Add missing flag to unrar