Skip to content

Commit

Permalink
Add bash_macros_backup(), bump to 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Schinkel committed Jan 23, 2023
1 parent 8926169 commit 7f3b565
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/macros.sh
/macros.sh.bak
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-->

## [1.0.4] - 2023-01-23

### Added

- Added a bash_macros_backup() command to backup macros.sh to macros.sh.bak.

## [1.0.3] - 2023-01-22

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ You must have [Git](https://git-scm.com/) installed and in your `$PATH`.
From your Bash terminal command line, run this command:

```
source <(curl -sL https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.3/install.sh)
source <(curl -sL https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.4/install.sh)
```

Here is a [**link to the installer**](https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.3/install.sh) for your pre-installation inspection.
Here is a [**link to the installer**](https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.4/install.sh) for your pre-installation inspection.

## To Uninstall

Expand Down
19 changes: 17 additions & 2 deletions bash-macros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,26 @@ alias mm="bash_macro_move"
alias mc="bash_macros_clear"
alias mr="bash_macros_reload"
alias me="bash_macros_edit"
alias mb="bash_macros_backup"

function bash_macros_aliases() {
echo "ma mh ml ms md mm mc mr"
}

function bash_macros_help() {
local rel_file
rel_file="$(bash_macros_rel_file)"

bash_macros_init
echo "Bash Macros Help:"
echo
echo " - mh — Show (this) Bash Macros help"
echo " - ml — List macros"
echo " - mc — Clear macros"
echo " - me — Edit macros file and reload"
echo " - ms — Save macros to ~/$(bash_macros_rel_file)"
echo " - mr — Reload macros from ~/$(bash_macros_rel_file)"
echo " - ms — Save macros to ~/${rel_file}"
echo " - mb — Backup macros to ~/${rel_file}.bak"
echo " - mr — Reload macros from ~/${rel_file}"
echo " - ma — Add macro from history"
echo " Syntax: ma <macro#> <command>"
echo " Example: ma 3 'git clone $(bash_macros_repo_url)'"
Expand Down Expand Up @@ -260,4 +265,14 @@ function bash_macros_edit() {
fi
}

function bash_macros_backup() {
local file
local bak

file="$(bash_macros_filepath)"
bak="${file}.bak"
cp "${file}" "${bak}"
echo "Bash macros backed up to ~/$(bash_macros_rel_file).bak"
}

bash_macros_reload assigned

0 comments on commit 7f3b565

Please sign in to comment.