Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code improvements #73

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3f80ca6
oh-my-bash.sh : Replaced $OSTYPE with $(uname)
Jul 24, 2019
f51e361
oh-my-bash.sh : Added error handling
Jul 24, 2019
f5c0018
oh-my-bash: Improved sanity for non-interactive shell
Jul 24, 2019
9dee040
oh-my-bash: Fixed this abomination
Jul 24, 2019
016ff57
oh-my-bash: code improvement
Jul 24, 2019
acfdadf
oh-my-bash: removed additional space
Jul 24, 2019
2f6c777
oh-my-bash: changed extension on .bash
Jul 24, 2019
68f95be
oh-my-bash: Double quoting and variable sanitization
Jul 24, 2019
a99d2ef
oh-my-bash: Sanitization for i$, not paying for dev licence
Jul 24, 2019
5a5488e
templates/bashrc.osh-template: reaction on #42
Jul 24, 2019
c324ece
Fixes for bash syntax
Jul 24, 2019
161854d
Replace .sh with .bash in all files
Jul 24, 2019
de4d2f3
sync
Aug 15, 2019
d3748c4
sync
Aug 15, 2019
688de57
Attempts to fix brew.completion.bash
Aug 15, 2019
15b9c95
Attempt to fix salt.completetion
Aug 15, 2019
2345678
themes/agnoster/agnoster.base.bash : QA fix
Aug 15, 2019
0c36bbf
themes/rjorgenson/rjorgenson.theme.bash : QA fix
Aug 15, 2019
8ba2e51
fixing syntax err
Aug 15, 2019
aaa88d2
Attempt to fix QA for salt.completion
Aug 15, 2019
ab79502
themes/agnoster.base : attempt to fix QA
Aug 15, 2019
26cf9fd
Fixing https://app.codacy.com/app/OhMyBash/oh-my-bash/file/3718039092…
Aug 15, 2019
7e6e9b6
QA fix
Aug 15, 2019
7970c31
QA: https://app.codacy.com/app/OhMyBash/oh-my-bash/file/37180391040/i…
Aug 15, 2019
384d496
Update git-prompt.bash
Kreyren Jan 1, 2022
6cab3b8
Update git-prompt.bash
Kreyren Jan 1, 2022
879609e
Update git-prompt.bash
Kreyren Jan 1, 2022
1b69844
Update git-prompt.bash
Kreyren Jan 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# custom files
!/custom/aliases/example.aliases.sh
!/custom/completion/example.completion.sh
!/custom/aliases/example.aliases.bash
!/custom/completion/example.completion.bash
!/custom/plugins/example/
!/custom/themes/example/
!/custom/example.sh
!/custom/example.bash
/custom/

# temp files directories
Expand Down
10 changes: 5 additions & 5 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)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.bash)"
```

#### via wget

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

## Using Oh My Bash
Expand Down Expand Up @@ -104,7 +104,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"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.bash)"
```

#### Manual Installation
Expand Down Expand Up @@ -148,9 +148,9 @@ If you have any hiccups installing, here are a few common fixes.

### Custom 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 want to override any of the default behaviors, just add a new file (ending in `.bash`) 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 have many functions that go well together, you can put them as a `XYZ.plugin.bash` 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/`.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#!/usr/bin/env bash
[[ -x "$(which aws_completer)" ]] &>/dev/null && complete -C "$(which aws_completer)" aws
10 changes: 10 additions & 0 deletions completions/brew.completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
if which brew >/dev/null 2>&1; then
if [ -f $(brew --prefix '/etc/bash_completion') ]; then
brew --prefix '/etc/bash_completion'
fi

if [ -f $(brew --prefix '/Library/Contributions/brew_bash_completion.bash') ]; then
brew --prefix '/Library/Contributions/brew_bash_completion.bash'
fi
fi
9 changes: 0 additions & 9 deletions completions/brew.completion.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! bash
#!/usr/bin/env bash
# bash completion for the `bundle` command.
#
# Copyright (c) 2011-2013 Daniel Luz <dev at mernen dot com>.
Expand All @@ -9,8 +9,8 @@
# . completion-bundle

__bundle() {
local cur=$2
local prev=$3
local cur="$2"
local prev="$3"
akinomyoga marked this conversation as resolved.
Show resolved Hide resolved
local bundle_command
__bundle_get_command
COMPREPLY=()
Expand All @@ -32,7 +32,7 @@ __bundle() {

__bundle_get_command() {
local i
for ((i=1; i < $COMP_CWORD; ++i)); do
for (i=1; i < $COMP_CWORD; ++i); do
akinomyoga marked this conversation as resolved.
Show resolved Hide resolved
local arg=${COMP_WORDS[$i]}

case $arg in
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# defaults
# Bash command line completion for defaults
#
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
Expand Down Expand Up @@ -69,4 +70,3 @@ else
fi

complete -F _python_django_completion -o default $pythons

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!bash
#!/usr/bin/env bash
#
# bash completion for docker-compose
#
Expand All @@ -12,9 +12,9 @@
# To enable the completions either:
# - place this file in /etc/bash_completion.d
# or
# - copy this file to e.g. ~/.docker-compose-completion.sh and add the line
# - copy this file to e.g. ~/.docker-compose-completion.bash and add the line
# below to your .bashrc after bash completion features are loaded
# . ~/.docker-compose-completion.sh
# . ~/.docker-compose-completion.bash


__docker_compose_q() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#!/usr/bin/env bash
# bash completion file for docker-machine commands
#
# This script provides completion of:
Expand All @@ -9,9 +9,9 @@
# To enable the completions either:
# - place this file in /etc/bash_completion.d
# or
# - copy this file to e.g. ~/.docker-machine-completion.sh and add the line
# - copy this file to e.g. ~/.docker-machine-completion.bash and add the line
# below to your .bashrc after bash completion features are loaded
# . ~/.docker-machine-completion.sh
# . ~/.docker-machine-completion.bash
#

_docker_machine_active() {
Expand Down Expand Up @@ -231,7 +231,7 @@ _docker_machine() {
local i
local command=docker-machine

for (( i=1; i < ${cword}; ++i)); do
for ( i=1; i < ${cword}; ++i); do
akinomyoga marked this conversation as resolved.
Show resolved Hide resolved
local word=${words[i]}
if [[ " ${wants_file[*]} ${wants_dir[*]} " =~ " ${word} " ]]; then
# skip the next option
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# bash completion file for core docker commands
#
Expand All @@ -11,9 +11,9 @@
# To enable the completions either:
# - place this file in /etc/bash_completion.d
# or
# - copy this file to e.g. ~/.docker-completion.sh and add the line
# - copy this file to e.g. ~/.docker-completion.bash and add the line
# below to your .bashrc after bash completion features are loaded
# . ~/.docker-completion.sh
# . ~/.docker-completion.bash
#
# Configuration:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# https://github.com/drush-ops/drush
#
# Originally from:
# http://github.com/drush-ops/drush/blob/master/drush.complete.sh
# http://github.com/drush-ops/drush/blob/master/drush.complete.bash

# Ensure drush is available.
which drush &> /dev/null || alias drush &> /dev/null || return
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# hub tab-completion script for bash.
# This script complements the completion script that ships with git.

Expand Down Expand Up @@ -363,4 +364,3 @@ EOF
complete -o bashdefault -o default -o nospace -F _git gh 2>/dev/null \
|| complete -o default -o nospace -F _git gh
fi

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
Expand All @@ -21,7 +22,7 @@
# 2) Add the following line to your .bashrc/.zshrc:
# source ~/.git-completion.bash
# 3) Consider changing your PS1 to also show the current branch,
# see git-prompt.sh for details.
# see git-prompt.bash for details.
#
# If you use complex aliases of form '!f() { ... }; f', you can use the null
# command ':' as the first command in the function body to declare the desired
Expand Down Expand Up @@ -1844,7 +1845,7 @@ _git_config ()
return
;;
color.branch|color.diff|color.interactive|\
color.showbranch|color.status|color.ui)
color.bashowbranch|color.status|color.ui)
__gitcomp "always never auto"
return
;;
Expand Down Expand Up @@ -2016,7 +2017,7 @@ _git_config ()
color.interactive.help
color.interactive.prompt
color.pager
color.showbranch
color.bashowbranch
color.status
color.status.added
color.status.changed
Expand Down Expand Up @@ -2056,7 +2057,7 @@ _git_config ()
core.quotepath
core.repositoryFormatVersion
core.safecrlf
core.sharedRepository
core.basharedRepository
core.sparseCheckout
core.symlinks
core.trustctime
Expand Down Expand Up @@ -2164,7 +2165,7 @@ _git_config ()
interactive.singlekey
log.date
log.decorate
log.showroot
log.bashowroot
mailmap.file
man.
man.viewer
Expand Down Expand Up @@ -2243,7 +2244,7 @@ _git_config ()
sendemail.validate
showbranch.default
status.relativePaths
status.showUntrackedFiles
status.bashowUntrackedFiles
status.submodulesummary
submodule.
tar.umask
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
#!bash
#!/usr/bin/env bash
#
# git-flow-completion
# ===================
#
#
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
#
#
# The contained completion routines provide support for completing:
#
#
# * git-flow init and version
# * feature, hotfix and release branches
# * remote feature branch names (for `git-flow feature track`)
#
#
#
#
# Installation
# ------------
#
#
# To achieve git-flow completion nirvana:
#
#
# 0. Install git-completion.
#
#
# 1. Install this file. Either:
#
#
# a. Place it in a `bash-completion.d` folder:
#
#
# * /etc/bash-completion.d
# * /usr/local/etc/bash-completion.d
# * ~/bash-completion.d
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.bash) and put the following line in
# your .bashrc:
#
# source ~/.git-flow-completion.sh
#
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
#
# source ~/.git-flow-completion.bash
#
# 2. If you are using Git < 1.7.1: Edit git-completion.bash and add the following line to the giant
# $command case in _git:
#
#
# flow) _git_flow ;;
#
#
#
#
# The Fine Print
# --------------
#
#
# Copyright (c) 2010 [Justin Hileman](http://justinhileman.com)
#
#
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)

_git_flow ()
Expand Down Expand Up @@ -128,7 +128,7 @@ __git_flow_release ()
__gitcomp "$subcommands"
return
fi

case "$subcommand" in
finish)
__gitcomp "$(__git_flow_list_releases)"
Expand Down Expand Up @@ -174,4 +174,4 @@ __git_flow_list_hotfixes ()
# temporarily wrap __git_find_on_cmdline() for backwards compatibility
if [ -z "`type -t __git_find_subcommand`" ]; then
alias __git_find_subcommand=__git_find_on_cmdline
fi
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!bash
#!/usr/bin/env bash
#
# git-flow-completion
# ===================
Expand Down Expand Up @@ -27,12 +27,12 @@
# * /usr/local/etc/bash-completion.d
# * ~/bash-completion.d
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.bash) and put the following line in
# your .bashrc:
#
# source ~/.git-flow-completion.sh
# source ~/.git-flow-completion.bash
#
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
# 2. If you are using Git < 1.7.1: Edit git-completion.bash and add the following line to the giant
# $command case in _git:
#
# flow) _git_flow ;;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
function __gradle {
local cur=${COMP_WORDS[COMP_CWORD]}
local tasks=''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# grunt-cli
# http://gruntjs.com/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Borrowed from grunt-cli
# http://gruntjs.com/
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Bash completion script for homesick
#
# The homebrew bash completion script was used as inspiration.
Expand Down Expand Up @@ -57,4 +58,3 @@ _homesick_complete()
}

complete -o bashdefault -o default -F _homesick_complete homesick

File renamed without changes.
Loading