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

shellcheck all core files #1917

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions bash_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ done
# "_bash_it_main_file_type" param is empty so that files get sourced in glob order
for _bash_it_main_file_type in "" "aliases" "plugins" "completion"; do
BASH_IT_LOG_PREFIX="core: reloader: "
# shellcheck disable=SC2140
source "${BASH_IT}/scripts/reloader.bash" ${_bash_it_main_file_type:+"skip" "$_bash_it_main_file_type"}
source "${BASH_IT}/scripts/reloader.bash" "${_bash_it_main_file_type:+skip}" "$_bash_it_main_file_type"
BASH_IT_LOG_PREFIX="core: main: "
done

Expand Down
16 changes: 4 additions & 12 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
# root directories
#
aliases/
custom/
docs/
hooks/
lib/
scripts/
template/

# root files
#
Expand All @@ -28,6 +31,7 @@ bash_it.sh
clean_files.txt
install.sh
lint_clean_files.sh
uninstall.sh

# completions
#
Expand Down Expand Up @@ -75,18 +79,6 @@ completion/available/vault.completion.bash
completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash

# libraries
lib/appearance.bash
lib/colors.bash
lib/command_duration.bash
lib/helpers.bash
lib/history.bash
lib/log.bash
lib/preexec.bash
lib/preview.bash
lib/search.bash
lib/utilities.bash

# plugins
#
plugins/available/alias-completion.plugin.bash
Expand Down
2 changes: 1 addition & 1 deletion custom/example.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
#
# This is an example file. Don't use this for your custom scripts. Instead, create another file within the
# custom directory.
14 changes: 6 additions & 8 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Installation

#. Check out a clone of this repo to a location of your choice, such as
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bash_profile`` or ``~/.bashrc``\ , depending on your OS)
#. Edit your modified config (\ ``~/.bash_profile`` or ``~/.bashrc``\ ) file in order to customize Bash-it.
#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bashrc``\ )
#. Edit your modified config (\ ``~/.bashrc``\ ) file in order to customize Bash-it.
#. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details).

Install Options
Expand All @@ -18,7 +18,7 @@ The install script can take the following options:

* ``--interactive``\ : Asks the user which aliases, completions and plugins to enable.
* ``--silent``\ : Ask nothing and install using default settings.
* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bash_profile`` or ``~/.bashrc``\ ).
* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bashrc``\ ).
* ``--append-to-config``\ : Back up existing config file and append bash-it templates at the end.

When run without the ``--interactive`` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies.
Expand All @@ -28,16 +28,14 @@ When you run without the ``--no-modify-config`` switch, the Bash-it installer au
Use the ``--no-modify-config`` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it.

**NOTE**\ : Keep in mind how Bash loads its configuration files,
``.bash_profile`` for login shells (and in macOS in terminal emulators like `Terminal.app <http://www.apple.com/osx/apps/>`_ or
`iTerm2 <https://www.iterm2.com/>`_\ ) and ``.bashrc`` for interactive shells (default mode in most of the GNU/Linux terminal emulators),
to ensure that Bash-it is loaded correctly.
``.bash_profile`` for login shells and ``.bashrc`` for interactive shells, to ensure that Bash-it is loaded correctly.
A good "practice" is sourcing ``.bashrc`` into ``.bash_profile`` to keep things working in all the scenarios.
To achieve this, you can add this snippet in your ``.bash_profile``\ :

.. code-block::

if [ -f ~/.bashrc ]; then
. ~/.bashrc
if [[ $- == *"i"* && -f ~/.bashrc ]]; then
source ~/.bashrc
fi

Refer to the official `Bash documentation <https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files>`_ to get more info.
Expand Down
3 changes: 1 addition & 2 deletions docs/themes-list/atomic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Automatically via terminal


#. You can install the theme automatically using the ``sed`` command from your Linux or OSX Terminal.
#. On macOS, the ~/.bash_profile is used, not the ~/.bashrc.
#. For installation on windows you should use `\ ``Git-Bash`` <https://git-for-windows.github.io/>`_ or make sure the terminal emulator you use (ej: cygwin, mintty, etc) has the ``sed`` command installed.

Command to execute For Windows and Linux:
Expand All @@ -51,7 +50,7 @@ Command to execute for macOS:
.. code-block:: bash

# Set the "atomic" theme replacing the theme you are using of bash-it
sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bash_profile
sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bashrc

Features
--------
Expand Down
2 changes: 1 addition & 1 deletion docs/themes-list/powerline-base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ all powerline themes.

**IMPORTANT:** This theme requires that `a font with the Powerline symbols <https://github.com/powerline/fonts>`_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.

**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` or ``~/.bash_profile`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes.
**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes.

Provided Information
--------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/themes-list/powerline-multiline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To get the length of the left and right segments right, a *padding* value is use
In most cases, the default value (\ *2*\ ) works fine, but on some operating systems, this needs to be adjusted.
One example is *macOS High Sierra*\ , where the default padding causes the right segment to extend to the next line.
On macOS High Sierra, the padding value needs to be changed to *3* to make the theme look right.
This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bash_profile`` or ``~/.bashrc`` file:
This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bashrc`` file:

.. code-block:: bash

Expand Down
2 changes: 1 addition & 1 deletion docs/vcs_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Turn version control checking off to prevent slow directory navigation within la
Controlling Flags
^^^^^^^^^^^^^^^^^

Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bash_profile`` file that turns off/on version control information checking and display within all themes.
Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bashrc`` file that turns off/on version control information checking and display within all themes.
Version control checking is on by default unless explicitly turned off.

Set ``SCM_CHECK`` to 'false' to **turn off** version control checks for all themes:
Expand Down
Loading