tools/upgrade: Print instructions on upgrading failures

This commit is contained in:
Koichi Murase 2022-01-31 19:15:53 +09:00
parent 9a0b552de3
commit e58334b1df
2 changed files with 19 additions and 4 deletions

@ -114,7 +114,7 @@ The default location is `~/.oh-my-bash` (hidden in your home directory)
If you'd like to change the install directory with the `OSH` environment variable, either by running `export OSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
```shell
export OSH="$HOME/.dotfiles/oh-my-bash"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
export OSH="$HOME/.dotfiles/oh-my-bash"; bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
```
#### Manual Installation
@ -156,13 +156,22 @@ If you have any hiccups installing, here are a few common fixes.
* You _might_ need to modify your `PATH` in `~/.bashrc` if you're not able to find some commands after switching to `oh-my-bash`.
* If you installed manually or changed the install location, check the `OSH` environment variable in `~/.bashrc`.
### Custom Plugins and Themes
### Customization of Plugins and Themes
If you want to override any of the default behaviors, just add a new file (ending in `.sh`) in the `custom/` directory.
If you have many functions that go well together, you can put them as a `XYZ.plugin.sh` file in the `custom/plugins/` directory and then enable this plugin.
If you would like to override the functionality of a plugin distributed with Oh My Bash, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
If you would like to modify an existing module (theme/plugin/aliases/completion) bundled with Oh My Bash, first copy the original module to `custom/` directory and modify it. It will be loaded instead of the original one.
```bash
$ cd "$OSH_CUSTOM"
$ mkdir -p "$OSH_CUSTOM/themes"
$ cp -r {"$OSH","$OSH_CUSTOM"}/themes/agnoster
$ EDIT themes/agnoster/agnoster.theme.sh
```
If you would like to replace an existing module (theme/plugin/aliases/complet) bundled with Oh My Bash, create a module of the same name in the `custom/` directory so that it will be loaded instead of the original one.
## Getting Updates

@ -26,7 +26,13 @@ function _omb_upgrade {
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Bash"
if ! command git -C "$OSH" pull --rebase --stat origin master; then
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
# In case it enters the rebasing mode
printf '%s\n' "oh-my-bash: running 'git rebase --abort'..."
command git -C "$OSH" rebase --abort
printf "${RED}%s${NORMAL}\n" \
'There was an error updating.' \
"If you have uncommited changes in '$BOLD$OSH$NORMAL$RED', please commit, stash or discard them and retry updating." \
"If you have your own local commits in '$BOLD$OSH$NORMAL$RED' that conflict with the upstream changes, please resolve conflicts and merge the upstream manually."
return 1
fi