bash-it/themes/barbuk
John D Pell 1c3cbf7ca6
Delete `.shellcheckrc` (#1947)
* CI: disable Ubuntu 16.04 as it's EOL

https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/

* main: lint false positive

* install: lint

* plugins/cmd-returned-notify: don't `export`

* plugins/xterm: lint

* plugins/git: lint

* plugins/goenv: lint

* plugins/alias-completion: lint false positives

* plugins/alias-completion: fix SC2155, SC2154

Declare `locals` at the top of the function

* completion: lint completions using `bash_completion` functions

Match the style of the existing code

* completion/knife: lint false positives

* completion/knife: lint

* completion/sdkman: lint

* completion/composer: lint

* Move `.shellcheckrc` under `themes/`

* lib/theme: fix SC2155, SC2154, SC2034

* lib/colors: don't warn on unused variables

We assign a large number of variables here and they may or may not be used anywhere else, so disable SC2034 for this file (only).

Alsö disable SC2005 as the functions in this file were written before `printf` was invented and have to do some fancy metascripting to get escape sequences interpreted reliably. I’m not smart enough to fix this to use `printf`, so leave it for now.

* themes/agnoster: lint

* themes: disable SC2154 for colors

Each one of these themes will need it’s own fix for SC2154, possibly upstream.

Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.

* themes: disable SC2154, fix SC2155

Each one of these themes will need it’s own fix for SC2154, possibly upstream.

Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.

* Delete `.shellcheckrc`

* remove executable bit
2021-09-18 12:50:59 +03:00
..
README.rst add command time duration plugin (#1683) 2020-12-27 18:48:17 +02:00
barbuk.theme.bash Delete `.shellcheckrc` (#1947) 2021-09-18 12:50:59 +03:00

README.rst

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

.. _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

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='  '

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