1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-14 09:50:08 +00:00
Commit graph

307 commits

Author SHA1 Message Date
Marc Cornellà
c63ba17525
refactor(installer): simplify user_can_sudo check 2022-01-11 19:53:50 +01:00
Marc Cornellà
a0a949de56
fix(installer): fix sudo check for users with password or without privileges
The previous check only worked if the user could run `sudo` without typing the
password, which is almost none (I checked in Google Cloud Shell so I failed to
notice this).

This new check works whether the user has no sudo privileges, or if it has,
whether they have to type in the password or not.

It should really be easier to check if the user doesn't have privilege without
having to make them type the password.
2022-01-11 19:13:23 +01:00
Marc Cornellà
b7a59e6d5c
fix(installer): run chsh with sudo if user has privileges
This fixes the error in Google Cloud Shell, where a password prompt
appears when running `chsh` but the user (hello) does not have a
password.

If ran with `sudo`, the `chsh` command happens without a password
prompt.
2022-01-11 16:45:36 +01:00
Marc Cornellà
9c84c344d7
fix: disable log.showSignature in git log calls 2022-01-10 19:39:05 +01:00
Marc Cornellà
fbdc078fa6
style: use 24bit colors in Oh My Zsh logo if supported 2022-01-09 23:11:35 +01:00
Marc Cornellà
f85087005a
fix(installer): fix POSIX shell syntax of previous commit 2021-12-26 23:27:49 +01:00
Marc Cornellà
ba069e7731
fix(installer): don't hard-code user $HOME directory on install 2021-12-26 22:40:38 +01:00
Nick Aldwin
c66fc00401
feat(updater): show command to update when update skipped (#10465) 2021-12-01 12:44:15 +01:00
Marc Cornellà
2b96b7c54b
fix(updater): stop update if $ZSH is not a git repository (#10448)
Fixes #10448
2021-11-25 23:36:38 +01:00
Marc Cornellà
fb12e41353
fix(install): fix backslash in printf when showing logo (#10422)
Fixes #10422
2021-11-16 19:24:32 +01:00
Marc Cornellà
e3f7b8aa57
fix(updater): avoid git -C for compatibility with git < v1.8.5 (#10404)
Fixes #10404
2021-11-10 11:21:59 +01:00
Marc Cornellà
db19589fcf
refactor(updater): simplify check for available updates 2021-11-09 19:56:53 +01:00
Kevin Burke
e86c6f5e7f
style: use -n flag in head and tail commands (#10391)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
2021-11-09 09:04:10 +01:00
Marc Cornellà
7a2cb10625
fix(updater): stop update if connection unavailable 2021-11-05 19:47:29 +01:00
Marc Cornellà
1dba112041
fix(changelog): fix for ${(@ps:$sep:)var} construct in zsh < 5.0.8
In recent zsh versions, `${(@ps:$sep:)var}` where $sep is a variable containing
a separator string and $var is a string with multiple values separated by $sep,
the `p` flag makes zsh correctly expand $sep before splitting $var. In versions
older than 5.0.8, this doesn't happen, so we use `eval` to get the same effect.
2021-10-27 10:12:23 +02:00
Marc Cornellà
4b3a5c5411
fix(changelog): fix percent escapes in printf calls 2021-10-26 21:04:02 +02:00
Marc Cornellà
0267cb89eb
perf(changelog): use regex-match instead of sed to parse commit subjects 2021-10-26 21:04:01 +02:00
Marc Cornellà
140bfa8432
fix(changelog): go back to ignoring commits from merged branches 2021-10-26 21:04:01 +02:00
Marc Cornellà
9c8131e417
perf(changelog): use a single git log command to get all commit messages 2021-10-26 21:04:00 +02:00
Marc Cornellà
c2b9ae2937
fix(changelog): don't show more than 40 commits (#10345)
Fixes #10345
2021-10-26 13:23:07 +02:00
Marc Cornellà
19f9b6f1ad
feat(updater): add support for terminal hyperlinks 2021-10-13 11:58:56 +02:00
Marc Cornellà
607d2f1eda
Revert "fix(changelog): don't parse commits of ignored types"
This reverts commit 63b7e5767d.
2021-10-07 13:35:07 +02:00
Marc Cornellà
63b7e5767d
fix(changelog): don't parse commits of ignored types 2021-10-05 16:56:00 +02:00
Marc Cornellà
30d441713c
feat(updater): check if there are updates before prompting (#8387)
Fixes #8387
2021-10-04 10:47:10 +02:00
Marc Cornellà
0120749a54
feat(updater): add mode to only remind you to update when it's time (#10187)
Fixes #10187

Co-authored-by: NoPreserveRoot <NoPreserveRoot@pm.me>
2021-10-04 10:47:10 +02:00
Marc Cornellà
3c9743313c
refactor(updater): change auto-update settings to use zstyle 2021-10-04 10:47:10 +02:00
Marc Cornellà
57e8c959a0
style(installer): use rainbow logo and polish success message (#10211) 2021-09-23 18:28:34 +02:00
Marc Cornellà
098bcda691
feat(update): allow updating from branch set up on install
Closes #8788

Co-authored-by: Nikolas Garofil <nikolas@garofil.be>
2021-09-22 09:27:43 +02:00
Marc Cornellà
b79726b1c3
fix(update): silence typeset calls in upgrade.sh script (#10048)
Co-authored-by: yyny <6576327+yyny@users.noreply.github.com>
2021-09-16 17:01:58 +02:00
Marc Cornellà
37a60eebc1
chore(changelog): fix first-letter uppercase in breaking change messages 2021-09-07 17:13:46 +02:00
Marc Cornellà
f341c8c206
feat(changelog): print BREAKING CHANGE messages in a prettier way 2021-09-07 17:08:46 +02:00
Marc Cornellà
7336ebcd8f
feat(changelog): change style of BREAKING CHANGES header 2021-09-06 13:31:12 +02:00
Marc Cornellà
ad1837859b
fix(updater): fix reset ANSI escape code for resetting underline format 2021-08-17 16:35:42 +02:00
Marc Cornellà
7c5ab01a5f
fix(changelog): also display commits from merged branches 2021-08-14 22:41:48 +02:00
Marc Cornellà
36f444ed73
fix(update): fix error exit code on update check (#10033)
This patch removes the 'exit 1' status code when the update check
finishes or is ended with CTRL+C.

Fixes #10033
2021-07-08 16:11:16 +02:00
Marc Cornellà
0e7d7b87f3
feat(changelog): ignore merge commits 2021-07-07 10:40:05 +02:00
Logicer
270db70805
fix(update): correct description of how changelog is displayed (#9943) 2021-06-11 20:03:21 -07:00
Max Staff
279212f2cc
feat(theme_chooser): display non-zero exit code (#8428)
Fixes #8427
2021-04-06 12:23:59 +02:00
Marc Cornellà
02d07f3e3d
fix: use $USERNAME guaranteed to always be defined in zsh
Fixes #9701
2021-03-25 12:08:00 +01:00
Léa Gris
95a06f3927
refactor(installer): fix static analysis warnings (#9529)
* refactor(install.sh): fix static analysis warnings

Clear all warnings and errors raised by shellcheck.net static analysis.

- Replace non-POSIX shell use of `$OSTYPE` by POSIX compliant check on `uname -o`.
- Move variables out of`printf` format string.
- Refactor/simplify string formatters for error and underline.
- Fix expansion of arguments to a single string `$*` rather than individual elements `$@` within the error and underline formatters.

* fix(uname): non-posix -o option

* fix(install.sh): non portable which

Replaced non-portable `which zsh` by portable `command -v zsh`
2021-03-16 00:06:06 +01:00
Marc Cornellà
e8716cb570
fix(uninstall): fix renaming .zshrc when no original rc file found
Fixes #9629
Fixes #9700
2021-03-15 19:51:31 +01:00
Cai Cooper
6fbad5bf72
fix(update): don't error on upgrade no-op (#9685)
* Don't error on upgrade no-op

No error code is required for a non failure scenario.

* Manually check whether changes were pulled in `omz update`

Co-authored-by: Marc Cornellà <hello@mcornella.com>
2021-03-01 08:17:54 +01:00
Marc Cornellà
d978f385e5 fix(updater): refresh date of last update only on successful update 2021-01-21 11:52:09 +01:00
Marc Cornellà
3d51d63077 fix(changelog): fix spacing in breaking changes message 2021-01-10 20:43:32 +01:00
Marc Cornellà
86f805280f fix(changelog): display scope in breaking change messages 2021-01-05 19:17:27 +01:00
Marc Cornellà
a4a79eaa8c fix(changelog): remove CR characters in breaking change messages
The GitHub UI might not remove CR characters from commit description forms
filled from a Windows browser.
2020-12-30 20:02:24 +01:00
Marc Cornellà
4b2431e8b1 fix(updater): don't pipe changelog to less when updating
Fixes #9509
2020-12-28 19:40:03 +01:00
Marc Cornellà
e2c73cf59a fix(changelog): allow breaking change message to span multiple lines
This also allows the option to put extra paragraphs after the BREAKING CHANGE
message while properly displaying the breaking change message. Useful, for
example, to add signed-off or co-authored lines.
2020-12-12 14:22:26 +01:00
Marc Cornellà
e8e37eedbc feat(updater): save version prior to updating so omz changelog just works™
Fixes #9505
2020-12-12 13:50:53 +01:00
Marc Cornellà
92fa8153d5 fix(changelog): fix assoc array syntax for zsh 5.4.2 and older (#9495)
Also fixed a call to a defunct display:type-header function in displaying
breaking changes.
2020-12-07 20:58:12 +01:00
Marc Cornellà
5a888ff4ac fix(updater): don't show changelog when running unattended update (#9495)
Fixes #9495
2020-12-07 20:58:12 +01:00
Marc Cornellà
4f8964d8ff fix(changelog): fix highlight of codeblocks in subject 2020-12-04 12:38:32 +01:00
Marc Cornellà
81bbe86db0 fix(updater): properly show changelog via less 2020-12-04 12:33:36 +01:00
Marc Cornellà
3f8af040e9 fix(updater): fix ignored variable name in read
I used _ which is a convention in other languages, but in shell scripting
$_ is a special variable set by the shell, and in Zsh versions older than
5.0.6 it complains for being a `read-only variable`.

Fixes #9482
2020-12-02 11:57:37 +01:00
Marc Cornellà
021f0251e0 fix(updater): make sure to run it with zsh 2020-12-01 11:12:31 +01:00
Marc Cornellà
eeab4e5186 feat(updater): add changelog display by parsing the commit list 2020-11-30 15:48:46 +01:00
Marc Cornellà
889cd7acf3 refactor(updater): switch to Zsh execution and fix git remote detection logic 2020-11-30 15:48:46 +01:00
Marc Cornellà
eef04c62c2 fix(installer): fix error message if $ZSH exists when installing
Also prefix all formatting functions with fmt_

Related: #9427
2020-11-09 20:06:19 +01:00
Lucas Larson
a55a30ec39
update: return git error code on failure (#9238)
Fixes #9237
2020-09-09 11:07:46 +02:00
Marc Cornellà
03b6a72576 docs: document oneline argument passing to install script 2020-08-20 11:28:10 +02:00
Adam G. Emerson
93f8c0686c
docs: add fetch install command for FreeBSD (#9172)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-08-20 11:26:39 +02:00
Marc Cornellà
613045e7e5 Underline links in install and update script 2020-08-17 21:47:39 +02:00
M. Yas. Davoodeh
5c1a5c6ce9
update: prefix rm call with command in trap (#9107)
* Suppress the problematic trap output in check_upg

The newly added trap, in systems where `rm` is aliased to `rm="rm -v"`,
shows a message stating that "update.lock" has been removed each time `zsh` is called.
I simply suppressed it with directing the output to `/dev/null`.

* Use `command` instead of >/dev/null to suppress
2020-07-13 11:52:28 +02:00
Alex Zdanowicz
232cb19859
install: fix typo (#9069)
Changing 'your' to 'you'
2020-07-01 15:44:14 +02:00
Larson Carter
ce28ac42c8
Modernize install and update banners (#9045) 2020-06-28 22:06:13 +02:00
Marc Cornellà
97cf0bf4bd update: change dash in function name for sh compat (fixes #9064) 2020-06-28 18:54:59 +02:00
alexagnelli
48b98b957e
update: only update on a valid affirmative input (#9062)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-06-28 18:34:02 +02:00
Marc Cornellà
3c777ebf1b
update: refactor and fix logic in check_for_upgrade.sh (#8939) 2020-06-09 19:38:08 +02:00
Roman Perepelitsa
f7bf566555
update: fix bug in upgrade.sh: s/NORMAL/RESET/ (#8947) 2020-05-19 14:47:30 +02:00
Marc Cornellà
29eddb6613
update: display logo in rainbow colors (#8941) 2020-05-18 11:23:28 +02:00
Marc Cornellà
27f4e07932 updater: use hardcoded color sequences instead of tput 2020-03-11 14:28:37 +01:00
Marc Cornellà
6ba2d9de3d updater: use git config instead of git -c for git < v1.7.2
Fixes #8732
2020-03-11 14:28:15 +01:00
Marc Cornellà
14b4f62e65
updater: fix --autostash argument. Works for git > 1.7.1
See https://github.com/ohmyzsh/ohmyzsh/pull/7172#issuecomment-592875226
2020-02-29 14:53:06 +01:00
Mauricio Wolff
bccfe1389c
updater: add --autostash to git pull (#7172)
If I have custom configs (like theme customizations) I have to stash my changes and get them back after the update. 

By adding the --autostash on upgrade.sh, if I have any changes not commited they'll be reapplied after the upgrade, allowing me to have temporary customizations without any harm to the upgrade process.
2020-02-27 17:06:20 +01:00
Michael Dorst
1a880fdb9b
installer: add option to install without replacing .zshrc (#8209)
* Add option to install OMZ without replacing .zshrc

tools/install.sh respects REPLACE_RC environment variable
--noreplace-rc flag sets REPLACE_RC='no'

* Change REPLACE_RC=no to KEEP_ZSHRC=yes

Change --noreplace-rc to --keep-zshrc
2020-02-25 22:42:39 +01:00
Jonathan Chang
0e57142729
installer: remove redundant cp command (#8668) 2020-02-24 20:39:10 +01:00
Giuseppe
4deafdff96 Fix change to old shell on uninstall (#8430)
If there's no `~/.shell.pre-oh-my-zsh`, don't assume the default choice
is Bash.  In fact Zsh is the default shell for macOS since Catalina
(10.15) [1], yet users of other OSes have likely to have Bash as their
default.

This commit fix issue #8252

[1] https://support.apple.com/en-us/HT208050
2019-11-25 16:36:33 +01:00
Marc Cornellà
3cc1fa4046
Fix non-POSIX conditional syntax
Fixes #8416
2019-11-21 19:10:30 +01:00
Marc Cornellà
b80b1a1e8b Actions to take after repository migration is complete (#8394)
* Change project URL from robbyrussell to ohmyzsh org

* Update git remote to use ohmyzsh org repository
2019-11-20 17:26:18 -08:00
Quentin Dreyer
8b6b2ea07e upgrade: remove double whitespace in message (#7517) 2019-11-09 12:49:17 +01:00
Marc Cornellà
534ec60bfd Set default git-config values known to fix repository issues
- core.autocrlf=false -> #4069
- fsck.zeroPaddedFilemode -> #4963

Fixes #4069
Fixes #4963
2019-10-21 17:00:04 +02:00
Marc Cornellà
fd4571d1b0 installer: allow chsh to work in termux 2019-09-08 21:35:45 +02:00
Marc Cornellà
702a594df3 installer: don't rely on tput for coloring
tput is error-prone and may not be needed, since all the formatting
codes used are standard across all types of terminals.
2019-06-09 16:33:06 +02:00
Marc Cornellà
b944fee6ea installer: ask user about changing the shell to zsh 2019-06-03 17:18:25 +02:00
Marc Cornellà
0824dcc9fb installer: allow for tput errors
tput may throw errors on invalid $TERM values, for example.
This shorthand syntax allows for that as well as for if tput
doesn't exist.
2019-06-03 17:18:25 +02:00
Zach Whitten
2e54ba2dfb installer: restore previous default shell with uninstall
Co-authored-by: Antonio QUINTAVALLE <antonio.quintavalle@amadeus.com>
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2019-06-03 17:18:25 +02:00
Marc Cornellà
66d6d08841 installer: improve message formatting and color 2019-06-03 17:18:25 +02:00
Marc Cornellà
b931d6a9db installer: change to --unattended argument and add docs 2019-06-03 17:18:25 +02:00
Marc Cornellà
065844fdc0 installer: comment changes 2019-06-03 17:18:25 +02:00
Marc Cornellà
1cf42a506f installer: add option to not run zsh at the end
Co-authored-by: Liquidsoul <liquidsoul@liquidsoul.fr>
Co-authored-by: Alexander Polynomdivision <digitalmail555@googlemail.com>
Co-authored-by: loket <loket@cruftlab.io>
Co-authored-by: Connor Demille <subtlepseudonym@gmail.com>
2019-06-03 17:18:25 +02:00
Marc Cornellà
a40d93295f installer: don't run zsh at the end
Co-authored-by: Joel Kuzmarski <leoj3n@gmail.com>
2019-06-03 17:18:24 +02:00
Marc Cornellà
794ff4a62d installer: add ability to skip the default shell change
Co-authored-by: Marshall Ford <inbox@marshallford.me>
Co-authored-by: Joel Kuzmarski <leoj3n@gmail.com>
2019-06-03 17:18:24 +02:00
Andrew Janke
43b3126b5c installer: use timestamped backups to preserve all old zshrcs 2019-06-03 17:18:24 +02:00
Marc Cornellà
153f5e11ed installer: use default color sequences on missing tput
Supposed to be POSIX-compatible. Proved to work in dash, yash and whatever
alpine uses. See https://unix.stackexchange.com/a/371873
2019-06-03 17:18:24 +02:00
Marc Cornellà
220d69b2ce installer: allow configuration of remote URL to clone from 2019-06-03 17:18:24 +02:00
Andrew Janke
aa27430e10 installer: add ability to install from forked & branched repos
This facilitates testing of changes to the core installation code: you'll be
able to do a roundtrip test of install and uninstall using the working code on
your branch.

Controlled by passing $REPO and $BRANCH environment variables to install.sh.
2019-06-03 17:18:24 +02:00
Marc Cornellà
a6a093ba2a installer: improve zsh binary path search in setup_shell
This changes the behavior to default to the binary found first in $PATH,
then checking it's actually in the shells file (/etc/shells).

If that fails go back to the previous behavior, but actually check that
the path obtained exists in the filesystem.

Co-authored-by: Joel Kuzmarski <leoj3n@gmail.com>
2019-06-03 17:18:24 +02:00
Fran
9d2b3ce79f installer: fix for Solus OS and systems with no /etc/shells
Co-authored-by: Fredrik Fornwall <fredrik@fornwall.net>
2019-06-03 17:18:24 +02:00
Marc Cornellà
62216aaa8f installer: use guard clauses in setup_shell for better readability
Guard clauses are if constructs that return early if there is an error
that prevents continuing. This way there isn't a big nesting of if
expressions.
2019-06-03 17:18:23 +02:00
Raf Czlonka
8e10ac4d73 installer: make sure shell in /etc/shells is not commented
Otherwise we risk a situation where a full path to `zsh` is commented, i.e.:

    #/usr/local/bin/zsh
2019-06-03 17:18:23 +02:00