Skip to content

Commit

Permalink
Merge pull request #2 from DiegoMow/master
Browse files Browse the repository at this point in the history
Sync Feature Branch
  • Loading branch information
diegom-ciandt authored Dec 7, 2020
2 parents dfde602 + ab6b218 commit d131c62
Show file tree
Hide file tree
Showing 93 changed files with 1,088 additions and 42 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: nntoan
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.buymeacoffee.com/nntoan']# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# custom files
!/custom/aliases/example.aliases.sh
!/custom/completion/example.completion.sh
!/custom/completions/example.completion.sh
!/custom/plugins/example/
!/custom/themes/example/
!/custom/example.sh
Expand Down
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2017-2020 Toan Nguyen and contributors (https://github.com/ohmybash/oh-my-bash/graphs/contributors)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13 changes: 0 additions & 13 deletions LICENSE.txt

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Oh My Bash is installed by running one of the following commands in your termina
#### via curl

```shell
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
```

#### via wget

```shell
sh -c "$(wget https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh -O -)"
bash -c "$(wget https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh -O -)"
```

## Using Oh My Bash
Expand All @@ -56,7 +56,7 @@ Most plugins (should! we're working on this) include a __README__, which documen

### Themes

We'll admit it. Early in the Oh My Bash world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmybash/oh-my-bash/wiki/Themes) on the wiki. Check them out!
We'll admit it. Early in the Oh My Bash world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmybash/oh-my-bash/wiki/Themes) on our wiki or alternatively [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh/wiki/themes) wiki.

#### Selecting a Theme

Expand Down Expand Up @@ -198,4 +198,4 @@ Thank you so much!

## License

Oh My Bash is released under the [WTFPL license](LICENSE.txt).
Oh My Bash is released under the [MIT license](LICENSE.md).
1 change: 1 addition & 0 deletions aliases/general.aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ alias c='clear' # c: Clear terminal displ
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
alias show_options='shopt' # Show_options: display bash options settings
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up
alias fix_term='echo -e "\033c"' # fix_term: Reset the conosle. Similar to the reset command
alias cic='set completion-ignore-case On' # cic: Make tab-completion case-insensitive
alias src='source ~/.bashrc' # src: Reload .bashrc file
8 changes: 8 additions & 0 deletions completions/minikube.completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# minikube (Kubernetes CLI) completion

if command -v minikube &>/dev/null
then
eval "$(minikube completion bash)"
fi
File renamed without changes.
1 change: 0 additions & 1 deletion lib/theme-and-appearance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

# colored ls
export LSCOLORS='Gxfxcxdxdxegedabagacad'
alias ls='ls -G'
5 changes: 1 addition & 4 deletions lib/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,7 @@ is_confirmed() {
# fi
#
type_exists() {
if [ "$(type -P "$1")" ]; then
return 0
fi
return 1
[ "$(type -P "$1")" ]
}

#
Expand Down
32 changes: 32 additions & 0 deletions plugins/ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ansible plugin

## Introduction

The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).

To use it, add `ansible` to the plugins array of your bashrc file:

```
plugins=(... ansible)
```

## Aliases

| Command | Description |
|:-------------------------------------------|:--------------------------------------------------------------------|
| `ansible-version` / `aver` | Show the version on ansible installed in this host |
| `ansible-role-init <role name>` / `arinit` | Creates the Ansible Role as per Ansible Galaxy standard |
| `a` | command `ansible` |
| `aconf` | command `ansible-config` |
| `acon` | command `ansible-console` |
| `ainv` | command `ansible-inventory` |
| `aplaybook` | command `ansible-playbook` |
| `ainv` | command `ansible-inventory` |
| `adoc` | command `ansible-doc` |
| `agal` | command `ansible-galaxy` |
| `apull` | command `ansible-pull` |
| `aval` | command `ansible-vault` |

## Maintainer

### [Deepankumar](https://github.com/deepan10)
28 changes: 28 additions & 0 deletions plugins/ansible/ansible.plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Functions
function ansible-version(){
ansible --version
}

function ansible-role-init(){
if ! [ -z $1] ; then
echo "Ansible Role : $1 Creating...."
ansible-galaxy init $1
tree $1
else
echo "Usage : ansible-role-init <role name>"
echo "Example : ansible-role-init role1"
fi
}

# Alias
alias a='ansible '
alias aconf='ansible-config '
alias acon='ansible-console '
alias aver='ansible-version'
alias arinit='ansible-role-init'
alias aplaybook='ansible-playbook '
alias ainv='ansible-inventory '
alias adoc='ansible-doc '
alias agal='ansible-galaxy '
alias apull='ansible-pull '
alias aval='ansible-vault'
2 changes: 1 addition & 1 deletion plugins/bashmarks/bashmarks.plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function _purge_line {
trap "/bin/rm -f -- '$t'" EXIT

# purge line
sed "/$2/d" "$1" > "$t"
sed "/$2/d" "$1" >| "$t"
/bin/mv "$t" "$1"

# cleanup temp file
Expand Down
33 changes: 18 additions & 15 deletions plugins/battery/battery.plugin.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
#!/usr/bin/env bash

# Bug: https://github.com/ohmybash/oh-my-bash/issues/68
if ! command -v "command_exists" >/dev/null; then command_exists() { command -v "$1" >/dev/null ; } fi

ac_adapter_connected(){
if _command_exists upower;
if command_exists upower;
then
upower -i $(upower -e | grep BAT) | grep 'state' | grep -q 'charging\|fully-charged'
return $?
elif _command_exists acpi;
elif command_exists acpi;
then
acpi -a | grep -q "on-line"
return $?
elif _command_exists pmset;
elif command_exists pmset;
then
pmset -g batt | grep -q 'AC Power'
return $?
elif _command_exists ioreg;
elif command_exists ioreg;
then
ioreg -n AppleSmartBattery -r | grep -q '"ExternalConnected" = Yes'
return $?
elif _command_exists WMIC;
elif command_exists WMIC;
then
WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=2'
return $?
fi
}

ac_adapter_disconnected(){
if _command_exists upower;
if command_exists upower;
then
upower -i $(upower -e | grep BAT) | grep 'state' | grep -q 'discharging'
return $?
elif _command_exists acpi;
elif command_exists acpi;
then
acpi -a | grep -q "off-line"
return $?
elif _command_exists pmset;
elif command_exists pmset;
then
pmset -g batt | grep -q 'Battery Power'
return $?
elif _command_exists ioreg;
elif command_exists ioreg;
then
ioreg -n AppleSmartBattery -r | grep -q '"ExternalConnected" = No'
return $?
elif _command_exists WMIC;
elif command_exists WMIC;
then
WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=1'
return $?
Expand All @@ -52,11 +55,11 @@ battery_percentage(){
about 'displays battery charge as a percentage of full (100%)'
group 'battery'

if _command_exists upower;
if command_exists upower;
then
local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage | tail --bytes 5)
echo ${UPOWER_OUTPUT: : -1}
elif _command_exists acpi;
elif command_exists acpi;
then
local ACPI_OUTPUT=$(acpi -b)
case $ACPI_OUTPUT in
Expand All @@ -83,7 +86,7 @@ battery_percentage(){
echo '-1'
;;
esac
elif _command_exists pmset;
elif command_exists pmset;
then
local PMSET_OUTPUT=$(pmset -g ps | sed -n 's/.*[[:blank:]]+*\(.*%\).*/\1/p')
case $PMSET_OUTPUT in
Expand All @@ -94,7 +97,7 @@ battery_percentage(){
echo $PMSET_OUTPUT | head -c 2
;;
esac
elif _command_exists ioreg;
elif command_exists ioreg;
then
local IOREG_OUTPUT=$(ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%05.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')
case $IOREG_OUTPUT in
Expand All @@ -105,7 +108,7 @@ battery_percentage(){
echo $IOREG_OUTPUT | head -c 2
;;
esac
elif _command_exists WMIC;
elif command_exists WMIC;
then
local WINPC=$(echo porcent=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List) | grep -o '[0-9]*')
case $WINPC in
Expand Down
22 changes: 22 additions & 0 deletions plugins/brew/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# brew plugin

The plugin adds several aliases for common [brew](https://brew.sh) commands.

To use it, add `brew` to the plugins array of your bashrc file:

```bash
plugins=(... brew)
```

## Aliases

| Alias | Command | Description |
|--------|----------------------|---------------|
| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade <formulae> command. |
| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. |
| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. |
| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
10 changes: 10 additions & 0 deletions plugins/brew/brew.plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

alias brewp='brew pin'
alias brews='brew list -1'
alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
alias bcubo='brew update && brew cask outdated'
alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
1 change: 1 addition & 0 deletions plugins/git/git.plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
alias gcps='git cherry-pick -s'
alias gcs='git commit -S'

alias gd='git diff'
Expand Down
29 changes: 29 additions & 0 deletions plugins/golang/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Golang plugin

The `golang plugin` plugin adds some aliases for common [Golang](https://golang.org/) commands.

To use it, add `golang` to the plugins array of your bashrc file:

```
plugins=(... golang)
```

## Aliases

| Alias | Command | Description |
| ------- | ----------------------- | ------------------------------------------------------------- |
| gob | `go build` | Build your code |
| goc | `go clean` | Removes object files from package source directories |
| god | `go doc` | Prints documentation comments |
| gof | `go fmt` | Gofmt formats (aligns and indents) Go programs. |
| gofa | `go fmt ./...` | Run go fmt for all packages in current directory, recursively |
| gog | `go get` | Downloads packages and then installs them to $GOPATH |
| goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages |
| gom | `go mod` | Access to operations on modules |
| gop | `cd $GOPATH` | Takes you to $GOPATH |
| gopb | `cd $GOPATH/bin` | Takes you to $GOPATH/bin |
| gops | `cd $GOPATH/src` | Takes you to $GOPATH/src |
| gor | `go run` | Compiles and runs your code |
| got | `go test` | Runs tests |
| gov | `go vet` | Vet examines Go source code and reports suspicious constructs |
17 changes: 17 additions & 0 deletions plugins/golang/golang.plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

alias gob='go build'
alias goc='go clean'
alias god='go doc'
alias gof='go fmt'
alias gofa='go fmt ./...'
alias gog='go get'
alias goi='go install'
alias gol='go list'
alias gom='go mod'
alias gop='cd $GOPATH'
alias gopb='cd $GOPATH/bin'
alias gops='cd $GOPATH/src'
alias gor='go run'
alias got='go test'
alias gov='go vet'
Loading

0 comments on commit d131c62

Please sign in to comment.