add bash-it

This commit is contained in:
2022-05-05 22:20:02 +02:00
parent 6a62a35d0d
commit 43701f0590
490 changed files with 33047 additions and 0 deletions

20
dot_bash_it/docs/Makefile Normal file
View File

@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@@ -0,0 +1,64 @@
![logo](https://github.com/Bash-it/media/raw/master/media/Bash-it.png)
![Build Status](../../../workflows/CI/badge.svg?event=push)
![Docs Status](https://readthedocs.org/projects/bash-it/badge/)
![License](https://img.shields.io/github/license/Bash-it/bash-it)
![shell](https://img.shields.io/badge/Shell-Bash-blue)
[![Join the chat at https://web.libera.chat/?channel=#bash-it](https://img.shields.io/badge/chat-on%20Libera.Chat-brightgreen.svg)](https://web.libera.chat/?channel=#bash-it)
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work.
If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away.
- [Main Page](https://bash-it.readthedocs.io/en/latest)
- [Contributing](#contributing)
- [Installation](#installation)
- [Install Options](https://bash-it.readthedocs.io/en/latest/installation/#install-options)
- [via Docker](https://bash-it.readthedocs.io/en/latest/installation/#install-using-docker)
- [Updating](https://bash-it.readthedocs.io/en/latest/installation/#updating)
- [Help](https://bash-it.readthedocs.io/en/latest/misc/#help-screens)
- [Search](https://bash-it.readthedocs.io/en/latest/commands/search)
- [Syntax](https://bash-it.readthedocs.io/en/latest/commands/search/#syntax)
- [Searching with Negations](
https://bash-it.readthedocs.io/en/latest/commands/search/#searching-with-negations)
- [Using Search to Enable or Disable Components](https://bash-it.readthedocs.io/en/latest/commands/search/#using-search-to-enable-or-disable-components)
- [Disabling ASCII Color](https://bash-it.readthedocs.io/en/latest/commands/search/#disabling-ascii-color)
- [Custom scripts, aliases, themes, and functions](
https://bash-it.readthedocs.io/en/latest/custom)
- [Themes](https://bash-it.readthedocs.io/en/latest/themes)
- [Uninstalling](https://bash-it.readthedocs.io/en/latest/uninstalling)
- [Misc](https://bash-it.readthedocs.io/en/latest/misc)
- [Help Out](https://bash-it.readthedocs.io/en/latest/#help-out)
- [Contributors](#contributors)
## Installation
1) 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``
2) Run ``~/.bash_it/install.sh``
That's it! :smiley:
You can check out more components of Bash-it, and customize it to your desire.
For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/).
## Contributing
Please take a look at the [Contribution Guidelines](https://bash-it.readthedocs.io/en/latest/contributing) before reporting a bug or providing a new feature.
The [Development Guidelines](https://bash-it.readthedocs.io/en/latest/development) have more information on some of the internal workings of Bash-it,
please feel free to read through this page if you're interested in how Bash-it loads its components.
## Contributors
[List of contributors](https://github.com/Bash-it/bash-it/contributors)
## License
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).

View File

@@ -0,0 +1,20 @@
.. _doctor:
Bash-it doctor
^^^^^^^^^^^^^^
If you encounter problems with any part of Bash-it, run the following command:
.. code-block:: bash
bash-it doctor
This will reload your bash profile and print out logs of various parts in Bash-it.
Note that this command at default will print all logs, including debug logs.
You can call it like this:
.. code-block:: bash
bash-it doctor [errors/warnings/all]
In order to get wanted verbosity.

View File

@@ -0,0 +1,16 @@
.. _commands:
Bash-it Commands
================
**Bash-it** boasts a wide range of available commands.
You should be familiar with them in order to fully utilize Bash-it.
.. toctree::
:maxdepth: 1
update
search
reload
doctor
profile

View File

@@ -0,0 +1,31 @@
.. _profile:
Bash-it Profile
---------------
Have you ever wanted to port your *Bash-it* configuration into another machine?
If you did, then ``bash-it profile`` is for you!
This command can save and load custom *"profile"* files, that can be later
used to load and recreate your configuration, in any machine you would like |:smile:|
When porting your configuration into a new machine, you just need to save your current profile, copy the resulting *"profile"* file, and load it in the other machine.
Example
^^^^^^^
.. code-block:: bash
# Saves your current profile
bash-it profile save my_profile
# Load the default profile, which is the one used in the default installation.
bash-it profile load default
# Do whatever you want:
# Disable stuff
bash-it disable ...
# Enable stuff
bash-it enable ...
# If you want to get back into your original configuration, you can do it easily
bash-it profile load my_profile

View File

@@ -0,0 +1,23 @@
.. _reload:
Bash-it reload
^^^^^^^^^^^^^^
Bash-it creates a ``reload`` alias that makes it convenient to reload
your Bash profile when you make changes.
Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value,
Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions.
.. warning::
When changing theme, do not use ``bash-it reload``. Instead, use :ref:`restart`.
.. _restart:
Bash-it restart
^^^^^^^^^^^^^^^
Similar to :ref:`reload`, ``bash-it restart`` can be used to restart your shell.
Instead of reloading your Bash profile, this command re-runs Bash (using exec).
This is stronger than simple reload, and is similar to the effect of closing and reopening your terminal.

View File

@@ -0,0 +1,59 @@
.. _searching:
Bash-it search
--------------
If you need to quickly find out which of the plugins, aliases or completions are available for a specific framework, programming language, or an environment, you can *search* for multiple terms related to the commands you use frequently.
Search will find and print out modules with the name or description matching the terms provided.
Syntax
^^^^^^
.. code-block:: bash
bash-it search term1 [[-]term2] [[-]term3]....
As an example, a ruby developer might want to enable everything related to the commands such as ``ruby``\ , ``rake``\ , ``gem``\ , ``bundler``\ , and ``rails``.
Search command helps you find related modules so that you can decide which of them you'd like to use:
.. code-block:: bash
bash-it search ruby rake gem bundle irb rails
aliases: bundler rails
plugins: chruby chruby-auto ruby
completions: bundler gem rake
Currently enabled modules will be shown in green.
Searching with Negations
^^^^^^^^^^^^^^^^^^^^^^^^
You can prefix a search term with a "-" to exclude it from the results.
In the above example, if we wanted to hide ``chruby`` and ``chruby-auto``\ ,
we could change the command as follows:
.. code-block:: bash
bash-it search ruby rake gem bundle irb rails -chruby
aliases: bundler rails
plugins: ruby
completions: bundler gem rake
Using Search to Enable or Disable Components
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
By adding a ``--enable`` or ``--disable`` to the search command, you can automatically enable all modules that come up as a result of a search query.
This could be quite handy if you like to enable a bunch of components related to the same topic.
Disabling ASCII Color
^^^^^^^^^^^^^^^^^^^^^
To remove non-printing non-ASCII characters responsible for the coloring of the search output, you can set environment variable ``NO_COLOR``.
Enabled components will then be shown with a checkmark:
.. code-block:: bash
NO_COLOR=1 bash-it search ruby rake gem bundle irb rails -chruby
aliases => ✓bundler ✓rails
plugins => ✓ruby
completions => bundler gem rake

View File

@@ -0,0 +1,38 @@
.. _update:
Bash-it update
^^^^^^^^^^^^^^
To update Bash-it to the latest stable version, simply run:
.. code-block:: bash
bash-it update stable
If you want to update to the latest dev version (directly from master), run:
.. code-block:: bash
bash-it update dev
If you want to update automatically and unattended, you can add the optional
``-s/--silent`` flag, for example:
.. code-block:: bash
bash-it update dev --silent
.. _migrate:
Bash-it migrate
^^^^^^^^^^^^^^^
If you are using an older version of Bash-it, it's possible that some functionality has changed, or that the internal structure of how Bash-it organizes its functionality has been updated.
For these cases, we provide a ``migrate`` command:
.. code-block:: bash
bash-it migrate
This command will automatically migrate the Bash-it structure to the latest version.
The ``migrate`` command is run automatically if you run the ``update``\ , ``enable`` or ``disable`` commands.

57
dot_bash_it/docs/conf.py Normal file
View File

@@ -0,0 +1,57 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'Bash-it'
copyright = '2020, Bash-it Team'
author = 'Bash-it Team'
# The full version, including alpha/beta/rc tags
release = ''
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_rtd_theme',
'sphinxemoji.sphinxemoji',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

View File

@@ -0,0 +1,115 @@
.. _contributing:
Contribution Guidelines
=======================
When contributing a new feature, a bug fix, a new theme, or any other change to Bash-it, please consider the following guidelines.
Most of this is common sense, but please try to stick to the conventions listed here.
Issues
------
* When reporting a bug or requesting a new feature, consider providing a Pull Request that fixes the issue or can be used as a starting point for the new feature.
Don't be afraid, most things aren't that complex...
Pull Requests
-------------
* Fork the Bash-it repo, create a new feature branch from *master* and apply your changes there.
Create a *Pull Request* from your feature branch against Bash-it's *master* branch.
* Limit each Pull Request to one feature.
Don't bundle multiple features/changes (e.g. a new *Theme* and a fix to an existing plugin) into a single Pull Request - create one PR for the theme, and a separate PR for the fix.
* For complex changes, try to *squash* your changes into a single commit before
pushing code. Once you've pushed your code and opened a PR, please refrain
from force-pushing changes to the PR branch remember, Bash-it is a
distributed project and your branch may be in use already.
* When in doubt, open a PR with too many commits. Bash-it is a learning project
for everyone involved. Showing your work provides a great history for folks
to learn what works and what didn't.
Code Style
----------
* When adding new files, be sure to add them into `clean_files.txt`, which is a growing list of linted files in the project.
* When changing existing files, consider also adding them into `clean_files.txt` and fixing the linting errors that arise. See :ref:`linting_your_changes` for more information.
* Indentation is using tabs, not spaces. Most of the code is indented with 2 spaces, some with 4 spaced tabs. Please try to stick to tabs.
If you're using an editor that supports `EditorConfig <http://EditorConfig.org>`_\ , the editor should automatically use the settings defined in Bash-it's `.editorconfig file <.editorconfig>`_.
* Prefer to invoke commands directly using the ``command`` shell builtin. This way, your code
will always execute the command you wanted and not an alias/function that overrides the name of the command. (For example, use ``command rm`` instead of ``rm``)
* When creating new functions, please use a dash ("-") to separate the words of the function's name, e.g. ``my-new-function``.
Don't use underscores, e.g. ``my_new_function``.
* Internal functions that aren't to be used by the end user should start with an underscore, e.g. ``_my-new-internal-function``.
* Use the provided meta functions to document your code, e.g. ``about-plugin``\ , ``about``\ , ``group``\ , ``param``\ , ``example``.
This will make it easier for other people to use your new functionality.
Take a look at the existing code for an example (e.g. `the base plugin <plugins/available/base.plugin.bash>`_\ ).
* When adding files, please use the existing file naming conventions, e.g. plugin files need to end in ``.plugin.bash``.
This is important for the installation functionality.
* When using the ``$BASH_IT`` variable, please always enclose it in double quotes to ensure that the code also works when Bash-it is installed in a directory that contains spaces in its name: ``for f in "${BASH_IT}/plugins/available"/*.bash ; do echo "$f" ; done``
* Bash-it supports Bash 3.2 and higher. Please don't use features only available in Bash 4, such as associative arrays.
Unit Tests
----------
When adding features or making changes/fixes, please run our growing unit test suite to ensure that you did not break existing functionality.
The test suite does not cover all aspects of Bash-it, but please run it anyway to verify that you did not introduce any regression issues.
Any code pushed to GitHub as part of a Pull Request will automatically trigger a continuous integration build on `GitHub Actions <https://github.com/Bash-it/bash-it/actions>`_\ , where the test suite is run on both Linux and macOS.
The Pull Request will then show the result of the CI build, indicating whether all tests ran fine, or whether there were issues.
Please pay attention to this, Pull Requests with build issues will not be merged.
Adding new functionality or changing existing functionality is a good opportunity to increase Bash-it's test coverage.
When you're changing the Bash-it codebase, please consider adding some unit tests that cover the new or changed functionality.
Ideally, when fixing a bug, a matching unit test that verifies that the bug is no longer present, is added at the same time.
To run the test suite, simply execute the following in the directory where you cloned Bash-it:
.. code-block:: bash
test/run
This command will ensure that the `Bats Test Framework <https://github.com/bats-core/bats-core>`_ is available in the local ``test_lib`` directory (Bats is included as a Git submodule) and then run the test suite found in the `test <test>`_ folder.
The test script will execute each test in turn, and will print a status for each test case.
When adding new test cases, please take a look at the existing test cases for examples.
The following libraries are used to help with the tests:
* Test Framework: https://github.com/bats-core/bats-core
* Support library for Bats-Assert: https://github.com/ztombol/bats-support
* General ``assert`` functions: https://github.com/ztombol/bats-assert
* File ``assert`` functions: https://github.com/ztombol/bats-file
When verifying test results, please try to use the ``assert`` functions found in these libraries.
Features
--------
* When adding new completions or plugins, please don't simply copy existing tools into the Bash-it codebase, try to load/integrate the tools instead.
An example is using ``nvm``\ : Instead of copying the existing ``nvm`` script into Bash-it, the ``nvm.plugin.bash`` file tries to load an existing installation of ``nvm``.
This means an additional step for the user (installing ``nvm`` from its own repo, or through a package manager),
but it will also ensure that ``nvm`` can be upgraded in an easy way.
.. _contributing_theme:
Themes
------
* When adding a new theme, please include a screenshot and a short description about what makes this theme unique in the Pull Request's description field.
Please do not add theme screenshots to the main PR itself, as they will add unnecessary bloat to the main branch in the repo.
The project's docs has a `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_ where you should add a screenshot, see how :ref:`here<add_screenshot>`.
* Ideally, you should add a ``<theme_name>.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder.
.. _add_screenshot:
Adding a Screenshot
-------------------
In order to add a new screenshot, use the ``gh-pages`` branch.
Add your new screenshot to the ``docs/images`` folder, and open a PR.
In the `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_, see the other screenshots to know what kind of link you should use.

View File

@@ -0,0 +1,18 @@
.. _custom:
Custom Content
--------------
For custom scripts, and aliases, just create the following files (they'll be ignored by the git repo):
* ``aliases/custom.aliases.bash``
* ``completion/custom.completion.bash``
* ``lib/custom.bash``
* ``plugins/custom.plugins.bash``
* ``custom/themes/<custom theme name>/<custom theme name>.theme.bash``
Anything in the custom directory will be ignored, with the exception of ``custom/example.bash``.
Alternately, if you would like to keep your custom scripts under version control, you can set ``BASH_IT_CUSTOM`` in your ``~/.bashrc`` to another location outside of the ``$BASH_IT`` folder.
In this case, any ``*.bash`` file under every directory below ``BASH_IT_CUSTOM`` folder will be used.

View File

@@ -0,0 +1,180 @@
.. _development:
Bash-it Development
===================
This page summarizes a couple of rules to keep in mind when developing features or making changes in Bash-it.
Testing
-------
Make sure to read the :ref:`testing docs<test>`.
Debugging and Logging
---------------------
General Logging
^^^^^^^^^^^^^^^
While developing feature or making changes in general, you can log error/warning/debug
using ``_log_error`` ``_log_warning`` and ``_log_debug``. This will help you solve problems quicker
and also propagate important notes to other users of Bash-it.
You can see the logs by using ``bash-it doctor`` command to reload and see the logs.
Alternatively, you can set ``BASH_IT_LOG_LEVEL`` to ``BASH_IT_LOG_LEVEL_ERROR``\ , ``BASH_IT_LOG_LEVEL_WARNING`` or ``BASH_IT_LOG_LEVEL_ALL``.
Log Prefix/Context
^^^^^^^^^^^^^^^^^^
You can define ``BASH_IT_LOG_PREFIX`` in your files in order to a have a constant prefix before your logs.
Note that we prefer to uses "tags" based logging, i.e ``plugins: git: DEBUG: Loading git plugin``.
Load Order
----------
General Load Order
^^^^^^^^^^^^^^^^^^
The main ``bash_it.sh`` script loads the frameworks individual components in the following order:
* ``vendor/github.com/erichs/composure/composure.sh``
* ``lib/log.bash``
* ``vendor/init.d/*.bash``
* Files in ``lib`` with the exception of ``appearance.bash`` - this means that ``log.bash`` is loaded again here (possible improvement?)
* Enabled ``aliases``
* Enabled ``plugins``
* Enabled ``completions``
* ``themes/colors.theme.bash``
* ``themes/base.theme.bash``
* ``lib/appearance.bash``\ , which loads the selected theme
* Custom ``aliases``
* Custom ``plugins``
* Custom ``completions``
* Additional custom files from either ``$BASH_IT/custom`` or ``$BASH_IT_CUSTOM``
This order is subject to change.
Individual Component Load Order
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For ``aliases``\ , ``plugins`` and ``completions``\ , the following rules are applied that influence the load order:
* There is a global ``enabled`` directory, which the enabled components are linked into. Enabled plugins are symlinked from ``$BASH_IT/plugins/available`` to ``$BASH_IT/enabled`` for example. All component types are linked into the same common ``$BASH_IT/enabled`` directory.
* Within the common ``enabled`` directories, the files are loaded in alphabetical order, which is based on the item's load priority (see next item).
* When enabling a component, a *load priority* is assigned to the file. The following default priorities are used:
* Aliases: 150
* Plugins: 250
* Completions: 350
* When symlinking a component into the ``enabled`` directory, the load priority is used as a prefix for the linked name, separated with three dashes from the name of the component. The ``node.plugin.bash`` would be symlinked to ``250---node.plugin.bash`` for example.
*
Each file can override the default load priority by specifying a new value. To do this, the file needs to include a comment in the following form. This example would cause the ``node.plugin.bash`` (if included in that file) to be linked to ``225---node.plugin.bash``\ :
.. code-block:: bash
# BASH_IT_LOAD_PRIORITY: 225
Having the order based on a numeric priority in a common directory allows for more flexibility. While in general, aliases are loaded first (since their default priority is 150), it's possible to load some aliases after the plugins, or some plugins after completions by setting the items' load priority. This is more flexible than a fixed type-based order or a strict alphabetical order based on name.
These items are subject to change. When making changes to the internal functionality, this page needs to be updated as well.
Working with vendored libs
--------------------------
Vendored libs are external libraries, meaning source code not maintained by Bash-it
developers.
They are ``git subtrees`` curated in the ``vendor/`` folder. To ease the work with git
vendored libs as subtrees we use the `git-vendor <https://github.com/Tyrben/git-vendor>`_ tool.
The `original repo <https://github.com/brettlangdon/git-vendor>`_ for git vendor is
unmaintained so for now we are recommending Tyrben's fork.
For more information on ``git vendor`` there are a short `usage description <https://github.com/Tyrben/git-vendor#usage>`_
in the repositories ``README`` file and a website for the original repository has a `manual page <https://brettlangdon.github.io/git-vendor/>`_ which is also included in both
repositories.
To support a flexible loading of external libraries, a file unique to the vendored
library must be placed in ``vendor/init.d/`` with the ``.bash`` extension.
Rebasing a feature branch with an added/updated vendored library
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If your feature branch with a newly added/updated vendored lib has fallen behind master
you might need to rebase it before creating a PR. However rebasing with dangling
subtree commits can cause problems.
The following rebase strategy will pause the rebase at the point where you added a
subtree and let you add it again before continuing the rebasing.
::
[feature/branch] $ git rebase --rebase-merges --strategy subtree master
fatal: refusing to merge unrelated histories
Could not apply 0d6a56b... Add-preexec-from-https-github-com-rcaloras-bash-preexec-0-4-1- # Add "preexec" from "https://github.com/rcaloras/bash-preexec@0.4.1"
[feature/branch] $ git vendor add preexec https://github.com/rcaloras/bash-preexec 0.4.1
...
[feature/branch] $ git rebase --continue
If rebasing makes you a little uneasy (as it probably should). You can always test in
another branch.
::
[feater/branch] $ git checkout -b feature/branch-test-rebase
[feater/branch-test-rebase] $ git rebase --rebase-merges --strategy subtree master
...
Afterwards you can make sure the rebase was successful by running ``git vendor list``
to see if your library is still recognized as a vendored lib
::
[feature/branch] $ git vendor list
preexec@0.4.1:
name: preexec
dir: vendor/github.com/rcaloras/bash-preexec
repo: https://github.com/rcaloras/bash-preexec
ref: 0.4.1
commit: 8fe585c5cf377a3830b895fe26e694b020d8db1a
[feature/branch] $
Plugin Disable Callbacks
------------------------
Plugins can define a function that will be called when the plugin is being disabled.
The callback name should be ``{PLUGIN_NAME}_on_disable``\ , you can see ``gitstatus`` for usage example.
Library Finalization Callback
-----------------------------
Specifically for Bash-it library code, e.g. in the `lib` subdirectory, a hook is available to run some code at the very end of the main loader script after all other code has been loaded. For example, `lib/theme` uses `_bash_it_library_finalize_hook+=('_bash_it_appearance_scm_init')` to add a function to be called after all plugins have been loaded.
Using the pre-commit hook
-------------------------
Note the file .pre-commit-config.yaml at the top of the repo.
This file configures the behavior of the a pre-commit hook based on `the Pre-Commit framework <https://pre-commit.com/>`_. Please see the site about
installing it (with pip, brew or other tools) then run ``pre-commit install`` in the repo's root to activate the hook.
For the full use of the tool, you may need to install also other third-party tools, such as
`shellcheck <https://github.com/koalaman/shellcheck/>`_ and `shfmt <https://github.com/mvdan/sh>`_.
.. _linting_your_changes:
Linting Your Changes
--------------------
In order to properly lint your changes, you should use our linting script,
by simply running ``./lint_clean_files.sh``. This script iterates over all marked-as-clean
files, and runs the pre-commit hook on them.
Please note that most of the files in the project are currently not linted,
as we want to make the linting process easier.
In order to add your changed/added files to the linting process,
please add your files to ``clean_files.txt``. This way ``lint_clean_files.sh``
will know to pick them up and lint them.
Thank you for helping clean up Bash-it, and making it a nicer and better project |:heart:|

View File

@@ -0,0 +1,13 @@
.. _help_screens:
Help Screens
^^^^^^^^^^^^
.. code-block:: bash
bash-it show aliases # shows installed and available aliases
bash-it show completions # shows installed and available completions
bash-it show plugins # shows installed and available plugins
bash-it help aliases # shows help for installed aliases
bash-it help completions # shows help for installed completions
bash-it help plugins # shows help for installed plugins

View File

@@ -0,0 +1,44 @@
Welcome to Bash-it's documentation!
===================================
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
(And a shameless ripoff of `oh-my-zsh <https://github.com/robbyrussell/oh-my-zsh>`_)
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work.
If you're using the *Bourne Again Shell* (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
Stop polluting your ``~/bin`` directory and your ``.bashrc`` file, fork/clone Bash-it and start hacking away.
.. toctree::
:maxdepth: 1
contributing
development
test
installation
commands/index
custom
themes
themes-list/index
vcs_user
misc
troubleshooting
uninstalling
Help out
--------
We think everyone has their own custom scripts accumulated over time.
And so, following in the footsteps of oh-my-zsh, Bash-it is a framework for easily customizing your Bash shell.
Everyone's got a custom toolbox, so let's start making them even better, **as a community!**
Send us a pull request and we'll merge it as long as it looks good.
If you change an existing command, please give an explanation why.
That will help a lot when we merge your changes in.
Please take a look at the :ref:`Contribution Guidelines <contributing>` before reporting a bug or providing a new feature.
Thanks, and happing bashing!

View File

@@ -0,0 +1,58 @@
.. _installation:
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.
#. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details).
Install Options
^^^^^^^^^^^^^^^
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``\ ).
* ``--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.
Feel free to enable the tools you want to use after the installation.
When you run without the ``--no-modify-config`` switch, the Bash-it installer automatically modifies/replaces your existing config file.
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.
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
fi
Refer to the official `Bash documentation <https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files>`_ to get more info.
Install using Docker
^^^^^^^^^^^^^^^^^^^^
You can try Bash-it in an isolated environment without changing any local files via a `Docker <https://www.docker.com/>`_ Container.
(Bash Shell v4.4 with Bash-it, `bats <https://github.com/sstephenson/bats>`_\ ,and bash-completion based on `Alpine Linux <https://alpinelinux.org/>`_\ ).
``docker pull ellerbrock/bash-it``
Have a look at our `bash-it-docker repository <https://github.com/Bash-it/bash-it-docker>`_ for further information.
Updating
^^^^^^^^
See :ref:`update command <update>`.

35
dot_bash_it/docs/make.bat Normal file
View File

@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

10
dot_bash_it/docs/misc.rst Normal file
View File

@@ -0,0 +1,10 @@
.. _misc:
Misc
----
.. toctree::
:maxdepth: 2
help_screens
proxy_support

View File

@@ -0,0 +1,43 @@
.. _proxy_support:
Proxy Support
^^^^^^^^^^^^^
If you are working in a corporate environment where you have to go through a proxy server for internet access,
then you know how painful it is to configure the OS proxy variables in the shell,
especially if you are switching between environments, e.g. office (with proxy) and home (without proxy).
The Bash shell (and many shell tools) use the following variables to define the proxy to use:
* ``HTTP_PROXY`` (and ``http_proxy``\ ): Defines the proxy server for HTTP requests
* ``HTTPS_PROXY`` (and ``https_proxy``\ ): Defines the proxy server for HTTPS requests
* ``ALL_PROXY`` (and ``all_proxy``\ ): Used by some tools for the same purpose as above
* ``NO_PROXY`` (and ``no_proxy``\ ): Comma-separated list of hostnames that don't have to go through the proxy
Bash-it's ``proxy`` plugin allows to enable and disable these variables with a simple command.
To start using the ``proxy`` plugin, run the following:
.. code-block:: bash
bash-it enable plugin proxy
Bash-it also provides support for enabling/disabling proxy settings for various shell tools.
The following backends are currently supported (in addition to the shell's environment variables): Git, SVN, npm, ssh.
The ``proxy`` plugin changes the configuration files of these tools to enable or disable the proxy settings.
Bash-it uses the following variables to set the shell's proxy settings when you call ``enable-proxy``.
These variables are best defined in a custom script in Bash-it's custom script folder (\ ``$BASH_IT/custom``\ ), e.g. ``$BASH_IT/custom/proxy.env.bash``
* ``BASH_IT_HTTP_PROXY`` and `BASH_IT_HTTPS_PROXY`: Define the proxy URL to be used, e.g. 'http://localhost:1234'
* ``BASH_IT_NO_PROXY``\ : A comma-separated list of proxy exclusions, e.g. ``127.0.0.1,localhost``
Once you have defined these variables (and have run ``reload`` to load the changes), you can use the following commands to enable or disable the proxy settings in your current shell:
* ``enable-proxy``\ : This sets the shell's proxy environment variables and configures proxy support in your SVN, npm, and SSH configuration files.
* ``disable-proxy``\ : This unsets the shell's proxy environment variables and disables proxy support in your SVN, npm, and SSH configuration files.
There are many more proxy commands, e.g. for changing the local Git project's proxy settings.
Run ``glossary proxy`` to show the available proxy functions with a short description.

View File

@@ -0,0 +1,4 @@
sphinx==3.2.1
sphinx-rtd-theme==0.5.0
sphinxemoji==0.1.8
docutils==0.17.1

46
dot_bash_it/docs/test.rst Normal file
View File

@@ -0,0 +1,46 @@
.. _test:
Testing Bash-it
===============
Overview
--------
The Bash-it unit tests leverage the `Bats unit test framework for Bash <https://github.com/bats-core/bats-core>`_.
There is no need to install Bats explicitly, the test run script will automatically download and install Bats and its dependencies.
When making changes to Bash-it, the tests are automatically executed in a test build environment on `Travis CI <https://travis-ci.com>`_.
Test Execution
--------------
To execute the unit tests, please run the ``run`` script:
.. code-block:: bash
# If you are in the `test` directory:
./run
# If you are in the root `.bash_it` directory:
test/run
The ``run`` script will automatically install if it is not already present, and will then run all tests found under the ``test`` directory, including subdirectories.
To run only a subset of the tests, you can provide the name of the test subdirectory that you want to run, e.g. like this for the tests in the ``test/themes`` directory:
.. code-block:: bash
# If you are in the root `.bash_it` directory:
test/run test/themes
By default, the tests run in single-threaded mode.
If you want to speed up the test execution, you can install the `GNU ``parallel`` tool <https://www.gnu.org/software/parallel/>`_\ , which is supported by Bats.
When using ``parallel``\ , the ``test/run`` script will use a number of threads in parallel, depending on the available CPU cores of your system.
This can speed up test execution significantly.
Writing Tests
-------------
When adding or modifying tests, please stick to the format and conventions of the existing test cases.
The ``test_helper.bash`` script provides a couple of reusable helper functions that you should use when writing a test case,
for example for setting up an isolated test environment.

View File

@@ -0,0 +1,200 @@
.. _atomic:
Atomic theme
============
The Best ColorFull terminal prompt theme inspired by a number of themes and based on the theme of @MunifTanjim :ref:`brainy <brainy>`.
Supported on all operating systems.
In constant maintenance and improvement
.. image:: https://raw.githubusercontent.com/lfelipe1501/lfelipe-projects/master/AtomicTheme.gif
:target: https://raw.githubusercontent.com/lfelipe1501/lfelipe-projects/master/AtomicTheme.gif
:alt: Atomic-Theme
Install Theme
-------------
Manually
^^^^^^^^
You can install the theme manually by following these steps:
Edit your modified config ``~/.bashrc`` file in order to customize Bash-it, set ``BASH_IT_THEME`` to the theme name ``atomic``.
Examples:
.. code-block:: bash
# Use the "atomic" theme
export BASH_IT_THEME="atomic"
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:
.. code-block:: bash
# Set the "atomic" theme replacing the theme you are using of bash-it
sed -i 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bashrc
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
Features
--------
Prompt Segments
^^^^^^^^^^^^^^^
* Username & Hostname
* Current Directory
* SCM Information
* Battery Charge
* Clock
* `Todo.txt <https://github.com/ginatrapani/todo.txt-cli>`_ status
* Ruby Environment
* Python Environment
* Exit Code
Others
^^^^^^
* Indicator for cached ``sudo`` credential
* Indicator for abort (ctrl + C) the current task and regain user control
* ``atomic`` command for showing/hiding various prompt segments on-the-fly
Configuration
-------------
Various prompt segments can be shown/hidden or modified according to your choice. There are two ways for doing that:
#. On-the-fly using ``atomic`` command
#. Theme Environment Variables
On-the-fly using ``atomic`` command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This theme provides a command for showing/hiding prompt segments.
``atomic show <segment>``
``atomic hide <segment>``
Tab-completion for this command is enabled by default.
Configuration specified by this command will only be applied to current and subsequent child shells.
Theme Environment Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is used for permanent settings that apply to all terminal sessions. You have to define the value of specific theme variables in your ``bashrc`` (or equivalent) file.
The name of the variables are listed below along with their default values.
User Information
~~~~~~~~~~~~~~~~
Indicator for cached ``sudo`` credential (see ``sudo`` manpage for more information):
``THEME_SHOW_SUDO=true``
SCM Information
~~~~~~~~~~~~~~~
Information about SCM repository status:
``THEME_SHOW_SCM=true``
Ruby Environment
~~~~~~~~~~~~~~~~
Ruby environment version information:
``THEME_SHOW_RUBY=false``
Python Environment
~~~~~~~~~~~~~~~~~~
Python environment version information:
``THEME_SHOW_PYTHON=false``
ToDo.txt status
~~~~~~~~~~~~~~~
`Todo.txt <https://github.com/ginatrapani/todo.txt-cli>`_ status:
``THEME_SHOW_TODO=false``
Clock
~~~~~
``THEME_SHOW_CLOCK=true``
``THEME_CLOCK_COLOR=$bold_cyan``
Format of the clock (see ``date`` manpage for more information):
``THEME_CLOCK_FORMAT="%H:%M:%S"``
Battery Charge
~~~~~~~~~~~~~~
Battery charge percentage:
``THEME_SHOW_BATTERY=false``
Exit Code
~~~~~~~~~
Exit code of the last command:
``THEME_SHOW_EXITCODE=true``
Prompt Segments Order
---------------------
Currently available prompt segments are:
* battery
* char
* clock
* dir
* exitcode
* python
* ruby
* scm
* todo
* user_info
Three environment variables can be defined to rearrange the segments order. The default values are:
``___ATOMIC_TOP_LEFT="user_info dir scm"``
``___ATOMIC_TOP_RIGHT="exitcode python ruby todo clock battery"``
``___ATOMIC_BOTTOM="char"``
Development by
^^^^^^^^^^^^^^
Developer / Author: `Luis Felipe Sánchez <https://github.com/lfelipe1501>`_
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

View File

@@ -0,0 +1,166 @@
.. _barbuk:
BarbUk theme
============
A minimal theme with a clean git prompt
Provided Information
--------------------
* Current git remote tool logo (support: github, gitlab, bitbucket)
* Current path (red when user is root)
* Current git info
* Last command exit code (only shown when the exit code is greater than 0)
* user@hostname for ssh connection
Default configuration
^^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
BARBUK_PROMPT="git-uptream-remote-logo ssh path scm python_venv ruby node terraform cloud duration exit"
You can override BARBUK_PROMPT to display only the desired information.
available block:
* git-uptream-remote-logo
* ssh
* path
* scm
* python_venv
* ruby
* node
* terraform
* cloud
* duration
* exit
Fonts and glyphs
----------------
A font with SCM glyphs is required to display the default tool/host logos.
You can use a font from https://www.nerdfonts.com/ or patch your own font with the tool
provided by https://github.com/ryanoasis/nerd-fonts.
You can also override the default variables if you want to use different glyphs or standard ASCII characters.
Default theme glyphs
^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
BARBUK_GITLAB_CHAR=' '
BARBUK_BITBUCKET_CHAR=' '
BARBUK_GITHUB_CHAR=' '
BARBUK_GIT_DEFAULT_CHAR=' '
BARBUK_GIT_BRANCH_ICON=''
BARBUK_HG_CHAR='☿ '
BARBUK_SVN_CHAR='⑆ '
BARBUK_EXIT_CODE_ICON=' '
BARBUK_PYTHON_VENV_CHAR=' '
BARBUK_COMMAND_DURATION_ICON='  '
BARBUK_RUBY_CHAR=' '
BARBUK_NODE_CHAR=' '
BARBUK_TERRAFORM_CHAR="t "
BARBUK_AWS_PROFILE_CHAR=" aws "
BARBUK_SCALEWAY_PROFILE_CHAR=" scw "
BARBUK_GCLOUD_CHAR=" gcp "
Customize glyphs
^^^^^^^^^^^^^^^^
Define your custom glyphs before sourcing bash-it:
.. code-block:: bash
export BARBUK_GITHUB_CHAR='•'
source "$BASH_IT"/bash_it.sh
SSH prompt
----------
Usage
^^^^^
When using a ssh session, the theme will display ``user@hostname``.
You can disable this information with ``BARBUK_SSH_INFO``.
The hostname is displayed in the FQDN format by default. You
can use the short hostname format with ``BARBUK_HOST_INFO``.
.. code-block:: bash
# short or long
export BARBUK_HOST_INFO=short
# true or false
export BARBUK_SSH_INFO=false
source "$BASH_IT"/bash_it.sh
Keep theme with sudoer
^^^^^^^^^^^^^^^^^^^^^^
If you want the theme to persist using ``sudo -s`` in a ssh session, you need to configure sudo to keep the ``HOME`` and ``SSH_CONNECTION`` environment variables.
``HOME`` contains the path to the home directory of the current user. Keeping it will allow to use your user dotfiles when elevating privileges.
Keeping ``SSH_CONNECTION`` env is necessary for ssh detection in the theme.
Please refer to the following documentation for more information:
* `sudo manual <https://www.sudo.ws/man/1.8.13/sudoers.man.html>`_ for ``env_keep`` configuration
* `openssh manual <https://linux.die.net/man/1/ssh>`_ for information about ``SSH_CONNECTION`` environment
.. code-block:: bash
cat << EOF > /etc/sudoers.d/keepenv
Defaults env_keep += HOME
Defaults env_keep += SSH_CONNECTION
EOF
chmod 400 /etc/sudoers.d/keepenv
Command duration
----------------
See :ref:`Command duration <command_duration>`.
Examples
--------
Clean
^^^^^
.. code-block:: bash
~
Git
^^^
.. code-block:: bash
 ~/.dotfiles on  master ⤏ origin ↑2 •7 ✗
Ssh
^^^
.. code-block:: bash
user@hostname in  ~/bash-it on  master ✓
Python venv
^^^^^^^^^^^
.. code-block:: bash
  flask ~/test on  master ✓
Command duration
^^^^^^^^^^^^^^^^
.. code-block:: bash
# sleep 3s
user@hostname in  ~/bash-it on  master ✓  3.2s

View File

@@ -0,0 +1,12 @@
.. _bira:
Bira Theme
==========
This is a port of Oh My Zsh's `'Bira' <https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/bira.zsh-theme>`_ theme. It looks the same as the original, except for the following changes:
* Exit code of last command is not shown
* More informative git prompt (if you want to keep it minimal, please read: :ref:`git_prompt`)
* Position and colour of virtualenv prompt
* No ruby version prompt

View File

@@ -0,0 +1,145 @@
.. _brainy:
Brainy theme
============
Simple colorful terminal prompt theme (inspired by a number of themes).
Features
--------
Prompt Segments
^^^^^^^^^^^^^^^
* Username & Hostname
* Current Directory
* SCM Information
* Battery Charge
* Clock
* `Todo.txt <https://github.com/ginatrapani/todo.txt-cli>`_ status
* Ruby Environment
* Python Environment
* Exit Code
Others
^^^^^^
* Indicator for cached ``sudo`` credential
* Indicator for ssh login
* ``brainy`` command for showing/hiding various prompt segments on-the-fly
Configuration
-------------
Various prompt segments can be shown/hidden or modified according to your choice. There are two ways for doing that:
#. On-the-fly using ``brainy`` command
#. Theme Environment Variables
On-the-fly using ``brainy`` command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This theme provides a command for showing/hiding prompt segments.
``brainy show <segment>``
``brainy hide <segment>``
Tab-completion for this command is enabled by default.
Configuration specified by this command will only be applied to current and subsequent child shells.
Theme Environment Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is used for permanent settings that apply to all terminal sessions. You have to define the value of specific theme variables in your ``bashrc`` (or equivalent) file.
The name of the variables are listed below along with their default values.
User Information
~~~~~~~~~~~~~~~~
Indicator for cached ``sudo`` credential (see ``sudo`` manpage for more information):
``THEME_SHOW_SUDO=true``
SCM Information
~~~~~~~~~~~~~~~
Information about SCM repository status:
``THEME_SHOW_SCM=true``
Ruby Environment
~~~~~~~~~~~~~~~~
Ruby environment version information:
``THEME_SHOW_RUBY=false``
Python Environment
~~~~~~~~~~~~~~~~~~
Python environment version information:
``THEME_SHOW_PYTHON=false``
ToDo.txt status
~~~~~~~~~~~~~~~
`Todo.txt <https://github.com/ginatrapani/todo.txt-cli>`_ status:
``THEME_SHOW_TODO=false``
Clock
~~~~~
``THEME_SHOW_CLOCK=true``
``THEME_CLOCK_COLOR=$bold_cyan``
Format of the clock (see ``date`` manpage for more information):
``THEME_CLOCK_FORMAT="%H:%M:%S"``
Battery Charge
~~~~~~~~~~~~~~
Battery charge percentage:
``THEME_SHOW_BATTERY=false``
Exit Code
~~~~~~~~~
Exit code of the last command:
``THEME_SHOW_EXITCODE=true``
Prompt Segments Order
---------------------
Currently available prompt segments are:
* battery
* char
* clock
* dir
* exitcode
* python
* ruby
* scm
* todo
* user_info
Three environment variables can be defined to rearrange the segments order. The default values are:
``___BRAINY_TOP_LEFT="user_info dir scm"``
``___BRAINY_TOP_RIGHT="python ruby todo clock battery"``
``___BRAINY_BOTTOM="exitcode char"``

View File

@@ -0,0 +1,28 @@
.. _codeword:
Codeword Theme
==============
Single line PS1 theme w/realtime history among windows.
Minimal theme overrides from bash_it base theming
``user@host:path[virt-env][scm] $``
---------------------------------------
Breakdown of the segments:
* **user@host:path** - *convienient for LAN based ``ssh`` and ``scp`` tasks*
* [\ **virtualenv**\ ] - *only appears when activated*
* [\ **scm**\ ] - *only appears when activated*
* **marker** - *$ or # depending on current user*
Examples
^^^^^^^^
.. code-block:: bash
user@example.lan:~ $ cd /tmp/foo/bar/baz
user@example.lan:/tmp/foo/bar/baz $ cd $HOME/workspace
user@example.lan:~/workspace $ cd sampleRepo/
user@example.lan:~/workspace/sampleRepo [± |master ↑1 ↓3 {1} S:2 ?:1 ✗|] $

View File

@@ -0,0 +1,14 @@
.. _easy:
Easy Theme
==========
A simple theme
Examples
--------
.. code-block:: bash
user@hostname ~/.bash_it
[ master ✓ ]

View File

@@ -0,0 +1,599 @@
.. _list_of_themes:
List of Themes
==============
Below is a list of most of the themes (with screenshots) and their documentation that `bash-it <https://github.com/Bash-it/bash-it/>`_ ships with.
.. note::
Not all themes have documentation!
.. toctree::
:maxdepth: 1
:caption: Documentation of Themes
:glob:
*
Alphabetical Screenshots List
-----------------------------
Bakke
^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/bakke-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/bakke-black.jpg
:alt: Bakke
.. image:: https://bash-it.github.io/bash-it/docs/images/bakke-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/bakke-white.jpg
:alt: Bakke
----
BarbUk
^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/BarbUk-black.png
:target: https://bash-it.github.io/bash-it/docs/images/BarbUk-black.png
:alt: BarbUk
.. image:: https://bash-it.github.io/bash-it/docs/images/BarbUk-white.png
:target: https://bash-it.github.io/bash-it/docs/images/BarbUk-white.png
:alt: BarbUk
----
Bobby
^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/bobby-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/bobby-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/bobby-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/bobby-white.jpg
:alt:
----
Brunton
^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/brunton-black.png
:target: https://bash-it.github.io/bash-it/docs/images/brunton-black.png
:alt:
----
Candy
^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/candy-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/candy-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/candy-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/candy-white.jpg
:alt:
----
Clean
^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/clean-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/clean-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/clean-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/clean-white.jpg
:alt:
----
Demula
^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/demula-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/demula-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/demula-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/demula-white.jpg
:alt:
----
DOS
^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/dos-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/dos-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/dos-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/dos-white.jpg
:alt:
----
DoubleTime
^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/doubletime-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/doubletime-white.jpg
:alt:
----
DoubleTime Multiline
^^^^^^^^^^^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-white.jpg
:alt:
----
Doubletime Multiline Python Only
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-white.jpg
:alt:
----
Easy
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/easy-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/easy-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/easy-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/easy-white.jpg
:alt:
----
Envy
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/envy-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/envy-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/envy-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/envy-white.jpg
:alt:
----
Iterate
^^^^^^^
Responsively wraps prompt based on terminal width.
.. image:: https://cloud.githubusercontent.com/assets/1319655/2923152/3a763194-d70e-11e3-9e52-3740de9bbb9b.png
:target: https://cloud.githubusercontent.com/assets/1319655/2923152/3a763194-d70e-11e3-9e52-3740de9bbb9b.png
:alt:
.. image:: https://cloud.githubusercontent.com/assets/1319655/2923143/14b8e0d2-d70e-11e3-9706-f5341fff8e5c.png
:target: https://cloud.githubusercontent.com/assets/1319655/2923143/14b8e0d2-d70e-11e3-9706-f5341fff8e5c.png
:alt:
----
Mr Briggs
^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/mbriggs-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/mbriggs-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/mbriggs-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/mbriggs-white.jpg
:alt:
----
Minimal
^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/minimal-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/minimal-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/minimal-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/minimal-white.jpg
:alt:
----
Modern
^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/modern-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/modern-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/modern-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/modern-white.jpg
:alt:
----
Modern T
^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/modern-t-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/modern-t-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/modern-t-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/modern-t-white.jpg
:alt:
----
Metal
^^^^^
.. image:: https://raw.githubusercontent.com/jrab66/bash-it/7cc82b518d6286fc68c8477d809ce9f417501976/themes/metal/metalthemeblack.png
:target: https://raw.githubusercontent.com/jrab66/bash-it/7cc82b518d6286fc68c8477d809ce9f417501976/themes/metal/metalthemeblack.png
:alt:
----
n0Qorg
^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/n0qorg-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/n0qorg-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/n0qorg-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/n0qorg-white.jpg
:alt:
----
.. _nwinkler_image:
NWinkler
^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/nwinkler-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/nwinkler-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/nwinkler-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/nwinkler-white.jpg
:alt:
----
.. _oh_my_posh_image:
Oh-My-Posh
^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/oh-my-posh.png
:target: https://bash-it.github.io/bash-it/docs/images/oh-my-posh.png
:alt:
----
Pete
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/pete-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/pete-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/pete-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/pete-white.jpg
:alt:
----
Powerline
^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/powerline-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/powerline-white.jpg
:alt:
----
Powerline Naked
^^^^^^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-naked-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/powerline-naked-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-naked-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/powerline-naked-white.jpg
:alt:
----
Powerline Plain
^^^^^^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-plain-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/powerline-plain-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-plain-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/powerline-plain-white.jpg
:alt:
----
Pure
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/pure-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/pure-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/pure-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/pure-white.jpg
:alt:
----
RainbowBrite
^^^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-white.jpg
:alt:
----
R Jorgenson
^^^^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/rjorgenson-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/rjorgenson-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/rjorgenson-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/rjorgenson-white.jpg
:alt:
----
Sexy
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/sexy-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/sexy-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/sexy-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/sexy-white.jpg
:alt:
----
Simple
^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/simple-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/simple-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/simple-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/simple-white.jpg
:alt:
----
SirUp
^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/sirup-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/sirup-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/sirup-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/sirup-white.jpg
:alt:
----
Standard
^^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/standard-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/standard-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/standard-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/standard-white.jpg
:alt:
----
Tonka
^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/tonka-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/tonka-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/tonka-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/tonka-white.jpg
:alt:
----
Tylenol
^^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/tylenol-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/tylenol-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/tylenol-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/tylenol-white.jpg
:alt:
----
Zitron
^^^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/zitron-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/zitron-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/zitron-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/zitron-white.jpg
:alt:
----
Zork
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/zork-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/zork-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/zork-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/zork-white.jpg
:alt:

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -0,0 +1,39 @@
.. _nwinkler_random_color:
Nwinkler Random Color Theme
===========================
Description
-----------
The *Nwinkler Random Color* Theme is based on the :ref:`Nwinkler Theme <nwinkler_image>` , but it randomizes the colors for:
* time
* username
* hostname
* path
The random colors are chosen the first time this theme is used and saved to the ``~/.nwinkler_random_colors`` file. So, the next time you connect to the same machine, you will get the same colors.
To force new random colors to be selected, run the command:
.. code-block:: sh
randomize_nwinkler
Screenshot
----------
Here it is in action:
.. image:: nwinkler_random_colors.png
:target: nwinkler_random_colors.png
:alt: alt text
Usage Scenario
--------------
This theme is especially useful when connecting to many different machines and switching between them often. Yes, the hostname *is* present in the prompt. But I argue that it's a lot faster to get a "feel" of what machine you are currently on because of the custom colors on that machine's prompt than by reading the hostname.

View File

@@ -0,0 +1,15 @@
.. _oh-my-posh:
Oh-My-Posh Theme
================
The oh-my-posh ״theme״ is really a plug to a whole other system
of managing your prompt. To use it please start here:
`Oh-My-Posh homepage <https://ohmyposh.dev/>`_
It is beyond the scope of bash-it to install and manage oh-my-posh,
this theme is here just to make sure your OMP setup doesn't clash
with other bash-it themes. Once installed, OMP will load a default
OMP theme (jandedobbeleer), which you can then customize or override.
Note: Nerd Fonts are highly recommended, as most of the themes are graphic candies.

View File

@@ -0,0 +1,130 @@
.. _powerline_base:
Base Powerline Theme Information
================================
This page explains base powerline theme information, shared between
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.
Provided Information
--------------------
* Current path
* Current username and hostname
* Current time
* Current shell level
* Current dirstack level (\ ``pushd`` / ``popd``\ )
* Current history number
* Current command number
* An indicator when connected by SSH
* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this)
* An indicator when the current shell is inside the Vim editor
* Battery charging status (depends on the battery plugin)
* SCM Repository status (e.g. Git, SVN)
* The current Kubernetes environment
* The current Python environment (Virtualenv, venv, and Conda are supported) in use
* The current Ruby environment (rvm and rbenv are supported) in use
* Last command exit code (only shown when the exit code is greater than 0)
Configuration
-------------
This theme is pretty configurable, all the configuration is done by setting environment variables.
User Information
^^^^^^^^^^^^^^^^
By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable:
.. code-block:: bash
export POWERLINE_PROMPT_USER_INFO_MODE="sudo"
For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time.
Clock Format
^^^^^^^^^^^^
You can change the format using the following variable:
.. code-block:: bash
export THEME_CLOCK_FORMAT="%H:%M:%S"
The time/date is printed by the ``date`` command, so refer to its man page to change the format.
Segment Order
^^^^^^^^^^^^^
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable
* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin)
* ``clock`` - Current time in ``HH:MM:SS`` format
* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ )
* ``duration`` - Duration of the last command. See :ref:`Command duration <command_duration>` for details.
* ``gcloud`` - Current gcloud active account
* ``hostname`` - Host name of machine
* ``in_toolbox`` - Show identifier if running inside a `toolbox <https://github.com/containers/toolbox>`_
* ``in_vim`` - Show identifier if running in ``:terminal`` from vim
* ``k8s_context`` - Show current kubernetes context
* ``k8s_namespace`` - Show current kubernetes namespace
* ``last_status`` - Exit status of last run command
* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv``
and ``conda`` supported)
* ``ruby`` - Current ruby version if using ``rvm``
* ``node`` - Current node version (only ``nvm`` is supported)
* ``scm`` - Version control information, ``git``
* ``terraform`` - Current terraform workspace
* ``user_info`` - Current user
* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder
hierarchy, only the directory you're currently in.
* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell
* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty
* ``history_number`` - Show current history number
* ``command_number`` - Show current command number
A variable can be defined to set the order of the prompt segments:
.. code-block::
POWERLINE_PROMPT="user_info scm python_venv ruby cwd"
The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable.
.. _powerline_compact_settings:
Compact Settings
^^^^^^^^^^^^^^^^
You can configure various aspects of the prompt to use less whitespace. Supported variables are:
.. list-table::
:header-rows: 1
* - Variable
- Description
* - POWERLINE_COMPACT_BEFORE_SEPARATOR
- Removes the leading space before each separator
* - POWERLINE_COMPACT_AFTER_SEPARATOR
- Removes the trailing space after each separator
* - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT
- Removes the leading space on the first segment
* - POWERLINE_COMPACT_AFTER_LAST_SEGMENT
- Removes the trailing space on the last segment
* - POWERLINE_COMPACT_PROMPT
- Removes the space after the prompt character
* - POWERLINE_COMPACT
- Enable all Compact settings (you can still override individual settings)
The default value for all settings is ``0`` (disabled). Use ``1`` to enable.

View File

@@ -0,0 +1,36 @@
.. _powerline_multiline:
Powerline Multiline Theme
=========================
A colorful multiline theme, where the first line shows information about your shell session (divided into two parts, left and right), and the second one is where the shell commands are introduced.
See :ref:`powerline_base` for general information about the powerline theme.
Soft Separators
^^^^^^^^^^^^^^^
Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them.
Padding
^^^^^^^
To get the length of the left and right segments right, a *padding* value is used.
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:
.. code-block:: bash
export POWERLINE_PADDING=3
Multiline Mode Right Prompt
^^^^^^^^^^^^^^^^^^^^^^^^^^^
For the purposes of the :ref:`Compact <powerline_compact_settings>` settings, the segments within the **Right Prompt** are considered to run "right-to-left", i.e.:
* The **right-most** segment is considered to be the ``"first"`` segment, while the **left-most** segment is considered to be the ``"last"``
* The space to the **right** of the separator character is considered to be ``"before"``\ , while the space to the **left** is considered to be ``"after"``

View File

@@ -0,0 +1,9 @@
.. _powerline_naked:
Powerline Naked Theme
=====================
A colorful theme, where shows a lot information about your shell session.
The naked powerline theme provides a cleaner shell with less background colors.
See :ref:`powerline_base` for general information about the powerline theme.

View File

@@ -0,0 +1,14 @@
.. _powerline_plain:
Powerline Plain Theme
=====================
A colorful theme, where shows a lot information about your shell session.
The plain powerline theme provides a simpler shell with less information.
See :ref:`powerline_base` for general information about the powerline theme.
Soft Separators
^^^^^^^^^^^^^^^
Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them.

View File

@@ -0,0 +1,13 @@
.. _powerline:
Powerline Theme
===============
A colorful theme, where shows a lot information about your shell session.
See :ref:`powerline_base` for general information about the powerline theme.
Soft Separators
^^^^^^^^^^^^^^^
Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them.

View File

@@ -0,0 +1,25 @@
.. _radek:
Radek Theme
===========
A colorful theme for Python developers.
It does not have any requirements.
Provided Information
--------------------
* Current username and hostname
* Current path
* Git repository status
* Current Python environment (venv, Conda )
* Current Python version
Examples
--------
.. code-block:: bash
[radek@photon][~/src/nokia2/cbis] ±[master → origin ↑1 {1}][venv-cbis][py-3.7.5]

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 KiB

View File

@@ -0,0 +1,56 @@
.. _redline:
Redline Theme
=============
changed up the powerline base a little.
It plays nicest with this font: `DroidSansMonoForPowerline <https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DroidSansMono>`_
Read the :ref:`powerline theme documentation <powerline>`
added
-----
* hostname
* distro logo
changed
-------
* sudo credential check
* required font
* some icons
Works real good like with:
.. code-block:: bash
## set the theme
export BASH_IT_THEME='redline'
# Set this to false to turn off version control status checking within the prompt for all themes
export SCM_CHECK=true
## Set Xterm/screen/Tmux title with only a short hostname.
export SHORT_HOSTNAME=$(hostname -s)
## enable sudo prompt
export POWERLINE_PROMPT_USER_INFO_MODE="sudo"
## prompt part string
export POWERLINE_PROMPT="python_venv user_info hostname cwd scm"
enable your distro logo with
----------------------------
.. code-block:: bash
export POWERLINE_PROMPT_DISTRO_LOGO="yes"
.. image:: redline.png
:target: redline.png?raw=true
:alt: screenshot

View File

@@ -0,0 +1,93 @@
.. _themes:
Themes
------
There are over 50+ Bash-it themes to pick from in ``$BASH_IT/themes``.
The default theme is ``bobby``.
Set ``BASH_IT_THEME`` to the theme name you want, or if you've developed your own custom theme outside of ``$BASH_IT/themes``\ ,
point the ``BASH_IT_THEME`` variable directly to the theme file.
To disable theming completely, leave the variable empty.
Examples:
.. code-block:: bash
# Use the "powerline-multiline" theme
export BASH_IT_THEME="powerline-multiline"
# Use a theme outside of the Bash-it folder
export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash"
# Disable theming
export BASH_IT_THEME=""
You can easily preview the themes in your own shell using ``bash-it preview``.
If you've created your own custom prompts, we'd love it if you shared them with everyone else! Just submit a Pull Request.
You can see theme screenshots on `wiki/Themes <https://github.com/Bash-it/bash-it/wiki/Themes>`_.
**NOTE**\ : Bash-it and some themes use UTF-8 characters, so to avoid strange behavior in your terminal, set your locale to ``LC_ALL=en_US.UTF-8`` or the equivalent to your language if it isn't American English.
List of Themes
^^^^^^^^^^^^^^
See :ref:`here <list_of_themes>`.
Theme Switches & Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _command_duration:
Command duration
================
Prints last command duration
Usage
#####
Command duration can be enabled by exporting ``BASH_IT_COMMAND_DURATION``:
.. code-block:: bash
export BASH_IT_COMMAND_DURATION=true
The default configuration display last command duration for command lasting one second or more.
You can customize the minimum time in seconds before command duration is displayed in your ``.bashrc``:
.. code-block:: bash
export COMMAND_DURATION_MIN_SECONDS=5
Clock Related
=============
function: ``clock_char``
########################
Prints a character indicating clock.
* ``THEME_SHOW_CLOCK_CHAR`` : **true**\ /false
* ``THEME_CLOCK_CHAR`` : "\ **⌚**\ "
* ``THEME_CLOCK_CHAR_COLOR`` : "\ **$normal**\ "
function: ``clock_prompt``
##########################
Prints the clock prompt (date, time).
* ``THEME_SHOW_CLOCK`` : **true**\ /false
* ``THEME_CLOCK_COLOR`` : "\ **$normal**\ "
* ``THEME_CLOCK_FORMAT`` : "\ **%H:%M:%S**\ "
Contributing a new theme
^^^^^^^^^^^^^^^^^^^^^^^^
See the :ref:`instructions <contributing_theme>`.

View File

@@ -0,0 +1,16 @@
.. _troubleshooting:
Troubleshooting Guide
=====================
Table of Contents
-----------------
* `I'm stuck in the LightDM login screen after setting up bash-it. <im-stuck-in-the-lightdm-login-screen-after-setting-up-bash-it>`_
I'm stuck in the LightDM login screen after setting up bash-it
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Possible issue**\ : `#672 <https://github.com/Bash-it/bash-it/issues/672>`_
**Solution**\ : Check `this comment <https://github.com/Bash-it/bash-it/issues/672#issuecomment-257870653>`_ for detailed information about the cause and solution for this issue.

View File

@@ -0,0 +1,14 @@
.. _uninstalling:
Uninstalling
------------
To uninstall Bash-it, run the ``uninstall.sh`` script found in the ``$BASH_IT`` directory:
.. code-block::
cd $BASH_IT
./uninstall.sh
This will restore your previous Bash profile.
After the uninstall script finishes, remove the Bash-it directory from your machine (\ ``rm -rf $BASH_IT``\ ) and start a new shell.

View File

@@ -0,0 +1,200 @@
.. _vcs_user:
Prompt Version Control Information
==================================
Bash-it provides prompt :ref:`themes` with the ability to check and display version control information for the current directory.
The information is retrieved for each directory and can slow down the navigation of projects with a large number of files and folders.
Turn version control checking off to prevent slow directory navigation within large projects.
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.
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:
* ``export SCM_CHECK=false``
Set ``SCM_CHECK`` to 'true' (the default value) to **turn on** version control checks for all themes:
* ``export SCM_CHECK=true``
**NOTE:**
It is possible for themes to ignore the ``SCM_CHECK`` flag and query specific version control information directly.
For example, themes that use functions like ``git_prompt_vars`` skip the ``SCM_CHECK`` flag to retrieve and display git prompt information.
If you turned version control checking off and you still see version control information within your prompt, then functions like ``git_prompt_vars`` are most likely the reason why.
.. _git_prompt:
Git prompt
^^^^^^^^^^
Bash-it has some nice features related to Git, continue reading to know more about these features.
Repository info in the prompt
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bash-it can show some information about Git repositories in the shell prompt: the current branch, tag or commit you are at, how many commits the local branch is ahead or behind from the remote branch, and if you have changes stashed.
Additionally, you can view the status of your working copy and get the count of *staged*\ , *unstaged* and *untracked* files.
This feature is controlled through the flag ``SCM_GIT_SHOW_DETAILS`` as follows:
Set ``SCM_GIT_SHOW_DETAILS`` to 'true' (the default value) to **show** the working copy details in your prompt:
* ``export SCM_GIT_SHOW_DETAILS=true``
Set ``SCM_GIT_SHOW_DETAILS`` to 'false' to **don't show** it:
* ``export SCM_GIT_SHOW_DETAILS=false``
**NOTE:** If using ``SCM_GIT_SHOW_MINIMAL_INFO=true``\ , then the value of ``SCM_GIT_SHOW_DETAILS`` is ignored.
Remotes and remote branches
^^^^^^^^^^^^^^^^^^^^^^^^^^^
In some git workflows, you must work with various remotes, for this reason, Bash-it can provide some useful information about your remotes and your remote branches, for example, the remote on you are working, or if your local branch is tracking a remote branch.
You can control this feature with the flag ``SCM_GIT_SHOW_REMOTE_INFO`` as follows:
Set ``SCM_GIT_SHOW_REMOTE_INFO`` to 'auto' (the default value) to activate it only when more than one remote is configured in the current repo:
* ``export SCM_GIT_SHOW_REMOTE_INFO=auto``
Set ``SCM_GIT_SHOW_REMOTE_INFO`` to 'true' to always activate the feature:
* ``export SCM_GIT_SHOW_REMOTE_INFO=true``
Set ``SCM_GIT_SHOW_REMOTE_INFO`` to 'false' to **disable the feature**\ :
* ``export SCM_GIT_SHOW_REMOTE_INFO=false``
**NOTE:** If using ``SCM_GIT_SHOW_MINIMAL_INFO=true``\ , then the value of ``SCM_GIT_SHOW_REMOTE_INFO`` is ignored.
Untracked files
^^^^^^^^^^^^^^^
By default, the ``git status`` command shows information about *untracked* files.
This behavior can be controlled through command-line flags or git configuration files.
For big repositories, ignoring *untracked* files can make git faster.
Bash-it uses ``git status`` to gather the repo information it shows in the prompt, so in some circumstances, it can be useful to instruct Bash-it to ignore these files.
You can control this behavior with the flag ``SCM_GIT_IGNORE_UNTRACKED``\ :
Set ``SCM_GIT_IGNORE_UNTRACKED`` to 'false' (the default value) to get information about *untracked* files:
* ``export SCM_GIT_IGNORE_UNTRACKED=false``
Set ``SCM_GIT_IGNORE_UNTRACKED`` to 'true' to **ignore** *untracked* files:
* ``export SCM_GIT_IGNORE_UNTRACKED=true``
Also, with this flag to false, Bash-it will not show the repository as dirty when the repo has *untracked* files, and will not display the count of *untracked* files.
**NOTE:** If you set in git configuration file the option to ignore *untracked* files, this flag has no effect, and Bash-it will ignore *untracked* files always.
Stash item count
^^^^^^^^^^^^^^^^
When ``SCM_GIT_SHOW_DETAILS`` is enabled, you can get the count of *stashed* items. This feature can be useful when a user has a lot of stash items.
This feature is controlled through the flag ``SCM_GIT_SHOW_STASH_INFO`` as follows:
Set ``SCM_GIT_SHOW_STASH_INFO`` to 'true' (the default value) to **show** the count of stashed items:
* ``export SCM_GIT_SHOW_STASH_INFO=true``
Set ``SCM_GIT_SHOW_STASH_INFO`` to 'false' to **don't show** it:
* ``export SCM_GIT_SHOW_STASH_INFO=false``
Ahead/Behind Count
^^^^^^^^^^^^^^^^^^
When displaying information regarding whether or not the local branch is ahead or behind its remote counterpart, you can opt to display the number of commits ahead/behind.
This is useful if you only care whether or not you are ahead or behind and do not care how far ahead/behind you are.
Set ``SCM_GIT_SHOW_COMMIT_COUNT`` to 'true' (the default value) to **show** the count of commits ahead/behind:
* ``export SCM_GIT_SHOW_COMMIT_COUNT=true``
Set ``SCM_GIT_SHOW_COMMIT_COUNT`` to 'false' to **don't show** it:
* ``export SCM_GIT_SHOW_COMMIT_COUNT=false``
Git user
^^^^^^^^
In some environments, it is useful to know the value of the current git user, which is used to mark all new commits.
For example, any organization that uses the practice of pair programming will typically author each commit with `combined names of the two authors <https://github.com/pivotal/git_scripts>`_.
When another pair uses the same pairing station, the authors are changed at the beginning of the session.
To get up and running with this technique, run ``gem install pivotal_git_scripts``\ , and then edit your ``~/.pairs`` file, according to the specification on the `gem's homepage <https://github.com/pivotal/git_scripts>`_.
After that, you should be able to run ``git pair kg as`` to set the author to, eg. "Konstantin Gredeskoul and Alex Saxby", assuming they've been added to the ``~/.pairs`` file.
Please see gem's documentation for more information.
To enable the display of the current pair in the prompt, you must set ``SCM_GIT_SHOW_CURRENT_USER`` to ``true``.
Once set, the ``SCM_CURRENT_USER`` variable will be automatically populated with the initials of the git author(s).
It will also be included in the default git prompt.
Even if you do not have ``git pair`` installed, as long as your ``user.name`` is set, your initials will be computed from your name and shown in the prompt.
You can control the prefix and the suffix of this component using the two variables:
* ``export SCM_THEME_CURRENT_USER_PREFFIX=' ☺︎ '``
And
* ``export SCM_THEME_CURRENT_USER_SUFFIX=' ☺︎ '``
**NOTE:** If using ``SCM_GIT_SHOW_MINIMAL_INFO=true``\ , then the value of ``SCM_GIT_SHOW_CURRENT_USER`` is ignored.
Git show minimal status info
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To speed up the prompt while still getting minimal git status information displayed such as the value of ``HEAD`` and whether there are any dirty objects, you can set:
.. code-block::
export SCM_GIT_SHOW_MINIMAL_INFO=true
Ignore repo status
^^^^^^^^^^^^^^^^^^
When working in repos with a large codebase, Bash-it can slow down your prompt when checking the repo status.
To avoid it, there is an option you can set via Git config to disable checking repo status in Bash-it.
To disable checking the status in the current repo:
.. code-block::
$ git config --add bash-it.hide-status 1
But if you would like to disable it globally, and stop checking the status for all of your repos:
.. code-block::
$ git config --global --add bash-it.hide-status 1
Setting this flag globally has the same effect as ``SCM_CHECK=true``\ , but only for Git repos.
Speed up git status calculations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
As an alternative to ignoring repo status entirely, you can try out the ``gitstatus`` plugin.
This plugin speeds up all ``git status`` calculations by up to 10x times!
**NOTE**\ : You will need to clone ``gitstatus`` repo from `here <https://github.com/romkatv/gitstatus>`_.