commit
a14cfe04c1
|
|
@ -5,8 +5,26 @@ indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
|
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[.git*]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.*sh]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
shell_variant = bash
|
||||||
|
binary_next_line = true # like -bn
|
||||||
|
switch_case_indent = true # like -ci
|
||||||
|
space_redirects = true # like -sr
|
||||||
|
keep_padding = true # like -kp
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,5 @@
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
*.bash text eol=lf
|
*.bash text eol=lf
|
||||||
|
|
||||||
|
# Windows files
|
||||||
|
*.bat text eol=crlf
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Configuration for probot-no-response - https://github.com/probot/no-response
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue is closed for lack of response
|
||||||
|
daysUntilClose: 14
|
||||||
|
# Label requiring a response
|
||||||
|
responseRequiredLabel: waiting-for-response
|
||||||
|
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
||||||
|
closeComment: >
|
||||||
|
This issue has been automatically closed because there has been no response
|
||||||
|
to our request for more information from the original author.
|
||||||
|
You can always reopen the issue if needed.
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
# Triggers the workflow on push or pull request events
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bats-test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-10.15, macos-11.0]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install greadlink
|
||||||
|
if: startsWith(runner.os, 'macOS')
|
||||||
|
run: brew install coreutils
|
||||||
|
- name: Test code
|
||||||
|
run: test/run
|
||||||
|
|
||||||
|
build-docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
- name: Install docs dependencies
|
||||||
|
run: python3 -m pip install -r docs/requirements.txt
|
||||||
|
- name: Build the docs
|
||||||
|
run: sphinx-build -W -b html docs docs/_build/html
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.14
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
- name: Install shfmt
|
||||||
|
run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
|
||||||
|
- name: Install shellcheck
|
||||||
|
run: brew install shellcheck
|
||||||
|
- name: Install pre-commit
|
||||||
|
run: python3 -m pip install -r test/lint-requirements.txt
|
||||||
|
- name: Run lint
|
||||||
|
run: ./lint_clean_files.sh
|
||||||
|
|
@ -15,4 +15,5 @@ bats
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
*.sublime-project
|
*.sublime-project
|
||||||
enabled/*
|
enabled/*
|
||||||
|
/enabled
|
||||||
tmp/
|
tmp/
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
[submodule "test_lib/bats-core"]
|
[submodule "test_lib/bats-core"]
|
||||||
path = test_lib/bats-core
|
path = test_lib/bats-core
|
||||||
url = https://github.com/bats-core/bats-core
|
url = https://github.com/bats-core/bats-core
|
||||||
|
branch = tags/v1.2.0
|
||||||
[submodule "test_lib/bats-support"]
|
[submodule "test_lib/bats-support"]
|
||||||
path = test_lib/bats-support
|
path = test_lib/bats-support
|
||||||
url = https://github.com/ztombol/bats-support
|
url = https://github.com/bats-core/bats-support
|
||||||
|
branch = tags/v0.3.0
|
||||||
[submodule "test_lib/bats-assert"]
|
[submodule "test_lib/bats-assert"]
|
||||||
path = test_lib/bats-assert
|
path = test_lib/bats-assert
|
||||||
url = https://github.com/ztombol/bats-assert
|
url = https://github.com/bats-core/bats-assert
|
||||||
|
branch = tags/v2.0.0
|
||||||
[submodule "test_lib/bats-file"]
|
[submodule "test_lib/bats-file"]
|
||||||
path = test_lib/bats-file
|
path = test_lib/bats-file
|
||||||
url = https://github.com/ztombol/bats-file
|
url = https://github.com/bats-core/bats-file
|
||||||
|
branch = tags/v0.3.0
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
---
|
||||||
|
# fail_fast: true
|
||||||
|
minimum_pre_commit_version: 1.18.1
|
||||||
|
exclude: "docs/_build/"
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: mixed-line-ending
|
||||||
|
- id: check-added-large-files
|
||||||
|
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
||||||
|
rev: 2.1.4
|
||||||
|
hooks:
|
||||||
|
- id: git-check # Configure in .gitattributes
|
||||||
|
- id: shellcheck
|
||||||
|
exclude: ".bats$"
|
||||||
|
- id: shfmt
|
||||||
|
exclude: ".bats$"
|
||||||
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||||
|
rev: v1.1.7
|
||||||
|
hooks:
|
||||||
|
# - id: forbid-crlf
|
||||||
|
- id: remove-crlf
|
||||||
|
exclude: ".bat$"
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
sphinx:
|
||||||
|
builder: htmldir
|
||||||
|
configuration: docs/conf.py
|
||||||
|
|
||||||
|
python:
|
||||||
|
version: 3.7
|
||||||
|
install:
|
||||||
|
- requirements: docs/requirements.txt
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
# We use colors and not assigned
|
||||||
|
disable=SC2154
|
||||||
|
# Hard to fix
|
||||||
|
disable=SC2155
|
||||||
|
# shellcheck is wrong on some
|
||||||
|
disable=SC2034
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
sudo: false
|
|
||||||
script: test/run
|
|
||||||
language: c
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
# 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 opening a new issue in the issue tracker, please include information about which _Operating System_ you're using, and which version of _Bash_.
|
|
||||||
* In many cases, it also makes sense to show which Bash-it plugins you are using.
|
|
||||||
This information can be obtained using `bash-it show plugins`.
|
|
||||||
* If the issue happens while loading Bash-it, please also include your `~/.bash_profile` or `~/.bashrc` file,
|
|
||||||
as well as the install location of Bash-it (default should be `~/.bash_it`).
|
|
||||||
* 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
|
|
||||||
|
|
||||||
* Try to stick to the existing code style. Please don't reformat or change the syntax of existing code simply because you don't like that style.
|
|
||||||
* Indentation is using spaces, not tabs. Most of the code is indented with 2 spaces, some with 4 spaces. Please try to stick to 2 spaces.
|
|
||||||
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).
|
|
||||||
* 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 [Travis CI](https://travis-ci.org/Bash-it/bash-it), where the test suite is run on both Linux and macOS.
|
|
||||||
The Pull Request will then show the result of the Travis 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:
|
|
||||||
|
|
||||||
```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.
|
|
||||||
|
|
||||||
## 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 repo itself, as they will add unnecessary bloat to the repo.
|
|
||||||
The project's Wiki has a _Themes_ page where you can add a screenshot if you want.
|
|
||||||
* Ideally, each theme's folder should contain a `README.md` file describing the theme and its configuration options.
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
# Bash-it Development
|
|
||||||
|
|
||||||
This page summarizes a couple of rules to keep in mind when developing features or making changes in Bash-it.
|
|
||||||
|
|
||||||
## Load Order
|
|
||||||
|
|
||||||
### General Load Order
|
|
||||||
|
|
||||||
The main `bash_it.sh` script loads the frameworks individual components in the following order:
|
|
||||||
|
|
||||||
* `lib/composure.bash`
|
|
||||||
* Files in `lib` with the exception of `appearance.bash` - this means that `composure.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`:
|
|
||||||
|
|
||||||
```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.
|
|
||||||
456
README.md
456
README.md
|
|
@ -1,456 +0,0 @@
|
||||||
# Bash-it
|
|
||||||
|
|
||||||
[](https://travis-ci.org/Bash-it/bash-it) [](https://gitter.im/Bash-it/bash-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
||||||
|
|
||||||
**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) on a regular basis 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.
|
|
||||||
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Install Options](#install-options)
|
|
||||||
- [via Docker](#install-using-docker)
|
|
||||||
- [Updating](#updating)
|
|
||||||
- [Help](#help-screens)
|
|
||||||
- [Search](#search)
|
|
||||||
- [Syntax](#syntax)
|
|
||||||
- [Searching with Negations](#searching-with-negations)
|
|
||||||
- [Using Search to Enable or Disable Components](#using-search-to-enable-or-disable-components)
|
|
||||||
- [Disabling ASCII Color](#disabling-ascii-color)
|
|
||||||
- [Custom scripts, aliases, themes, and functions](#custom-scripts-aliases-themes-and-functions)
|
|
||||||
- [Themes](#themes)
|
|
||||||
- [Uninstalling](#uninstalling)
|
|
||||||
- [Misc](#misc)
|
|
||||||
- [Help Out](#help-out)
|
|
||||||
- [Contributors](#contributors)
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Please take a look at the [Contribution Guidelines](CONTRIBUTING.md) before reporting a bug or providing a new feature.
|
|
||||||
|
|
||||||
The [Development Guidelines](DEVELOPMENT.md) 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.
|
|
||||||
|
|
||||||
## 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` (it automatically backs up your `~/.bash_profile` or `~/.bashrc`, depending on your OS)
|
|
||||||
3. Edit your modified config (`~/.bash_profile` or `~/.bashrc`) file in order to customize Bash-it.
|
|
||||||
4. 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`).
|
|
||||||
|
|
||||||
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 load 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`:
|
|
||||||
|
|
||||||
```
|
|
||||||
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
|
|
||||||
|
|
||||||
To update Bash-it to the latest version, simply run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bash-it update
|
|
||||||
```
|
|
||||||
|
|
||||||
that's all.
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
```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.
|
|
||||||
|
|
||||||
## Help Screens
|
|
||||||
|
|
||||||
```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
|
|
||||||
```
|
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
```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:
|
|
||||||
|
|
||||||
```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:
|
|
||||||
|
|
||||||
```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:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
❯ NO_COLOR=1 bash-it search ruby rake gem bundle irb rails -chruby
|
|
||||||
aliases => ✓bundler ✓rails
|
|
||||||
plugins => ✓ruby
|
|
||||||
completions => bundler gem rake
|
|
||||||
```
|
|
||||||
|
|
||||||
## Custom scripts, aliases, themes, and functions
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
```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_PREVIEW=true bash-it reload`.
|
|
||||||
|
|
||||||
If you've created your own custom prompts, we'd love it if you shared 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.
|
|
||||||
|
|
||||||
## Uninstalling
|
|
||||||
|
|
||||||
To uninstall Bash-it, run the `uninstall.sh` script found in the `$BASH_IT` directory:
|
|
||||||
|
|
||||||
```
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Misc
|
|
||||||
|
|
||||||
### Bash Profile Aliases
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
### Prompt Version Control Check
|
|
||||||
|
|
||||||
Bash-it provides prompt themes 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.
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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`
|
|
||||||
|
|
||||||
### 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:
|
|
||||||
|
|
||||||
```
|
|
||||||
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:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ 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:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ 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.
|
|
||||||
|
|
||||||
### Pass function renamed to passgen
|
|
||||||
|
|
||||||
The Bash-it `pass` function has been renamed to `passgen` in order to avoid a naming conflict with the [pass password manager](https://www.passwordstore.org/).
|
|
||||||
In order to minimize the impact on users of the legacy Bash-it `pass` function, Bash-it will create the alias `pass` that calls the new `passgen` function if the `pass` password manager command is not found on the `PATH` (default behavior).
|
|
||||||
|
|
||||||
This behavior can be overridden with the `BASH_IT_LEGACY_PASS` flag as follows:
|
|
||||||
|
|
||||||
Set `BASH_IT_LEGACY_PASS` to 'true' to force Bash-it to always **create** the `pass` alias to `passgen`:
|
|
||||||
|
|
||||||
* `export BASH_IT_LEGACY_PASS=true`
|
|
||||||
|
|
||||||
Unset `BASH_IT_LEGACY_PASS` to have Bash-it **return to default behavior**:
|
|
||||||
|
|
||||||
* `unset BASH_IT_LEGACY_PASS`
|
|
||||||
|
|
||||||
### 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:
|
|
||||||
|
|
||||||
```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.
|
|
||||||
|
|
||||||
## 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 [Contribution Guidelines](CONTRIBUTING.md) before reporting a bug or providing a new feature.
|
|
||||||
|
|
||||||
Thanks, and happing bashing!
|
|
||||||
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
* [List of contributors][contribute]
|
|
||||||
|
|
||||||
[contribute]: https://github.com/Bash-it/bash-it/contributors
|
|
||||||
[pass password manager]: http://www.passwordstore.org/
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
cite about-alias
|
||||||
|
about-alias 'Aliases for the bash-it command (these aliases are automatically included with the "general" aliases)'
|
||||||
|
|
||||||
|
# Common misspellings of bash-it
|
||||||
|
alias shit='bash-it'
|
||||||
|
alias batshit='bash-it'
|
||||||
|
alias bashit='bash-it'
|
||||||
|
alias batbsh='bash-it'
|
||||||
|
alias babsh='bash-it'
|
||||||
|
alias bash_it='bash-it'
|
||||||
|
alias bash_ti='bash-it'
|
||||||
|
|
||||||
|
# Additional bash-it aliases for help/show
|
||||||
|
alias bshsa='bash-it show aliases'
|
||||||
|
alias bshsc='bash-it show completions'
|
||||||
|
alias bshsp='bash-it show plugins'
|
||||||
|
alias bshha='bash-it help aliases'
|
||||||
|
alias bshhc='bash-it help completions'
|
||||||
|
alias bshhp='bash-it help plugins'
|
||||||
|
alias bshsch="bash-it search"
|
||||||
|
alias bshenp="bash-it enable plugin"
|
||||||
|
alias bshena="bash-it enable alias"
|
||||||
|
alias bshenc="bash-it enable completion"
|
||||||
|
|
@ -2,6 +2,8 @@ cite 'about-alias'
|
||||||
about-alias 'docker-compose abbreviations'
|
about-alias 'docker-compose abbreviations'
|
||||||
|
|
||||||
alias dco="docker-compose"
|
alias dco="docker-compose"
|
||||||
|
|
||||||
|
# Defined in the `docker-compose` plugin, please check there for details.
|
||||||
alias dcofresh="docker-compose-fresh"
|
alias dcofresh="docker-compose-fresh"
|
||||||
alias dcol="docker-compose logs -f --tail 100"
|
alias dcol="docker-compose logs -f --tail 100"
|
||||||
alias dcou="docker-compose up"
|
alias dcou="docker-compose up"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ alias dkrmflast='docker rm -f $(dklcid)'
|
||||||
alias dkbash='dkelc'
|
alias dkbash='dkelc'
|
||||||
alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host
|
alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host
|
||||||
alias dkri='docker run --rm -i '
|
alias dkri='docker run --rm -i '
|
||||||
|
alias dkric='docker run --rm -i -v $PWD:/cwd -w /cwd '
|
||||||
alias dkrit='docker run --rm -it '
|
alias dkrit='docker run --rm -it '
|
||||||
|
alias dkritc='docker run --rm -it -v $PWD:/cwd -w /cwd '
|
||||||
|
|
||||||
# Added more recent cleanup options from newer docker versions
|
# Added more recent cleanup options from newer docker versions
|
||||||
alias dkip='docker image prune -a -f'
|
alias dkip='docker image prune -a -f'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
# https://github.com/nvbn/thefuck
|
cite 'about-alias'
|
||||||
alias fuck='eval $(thefuck $(fc -ln -1))'
|
about-alias 'fuck/please to retry last command with sudo'
|
||||||
alias please='fuck'
|
|
||||||
|
# Play nicely with 'thefuck' plugin
|
||||||
|
if ! _command_exists fuck ; then
|
||||||
|
alias fuck='sudo $(fc -ln -1)'
|
||||||
|
fi
|
||||||
|
alias please=fuck
|
||||||
|
alias plz=please
|
||||||
|
alias fucking=sudo
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ alias vbpf="vim ~/.bash_profile"
|
||||||
if grep --color=auto "a" "${BASH_IT}/"*.md &> /dev/null
|
if grep --color=auto "a" "${BASH_IT}/"*.md &> /dev/null
|
||||||
then
|
then
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
export GREP_COLOR='1;33'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if which gshuf &> /dev/null
|
if which gshuf &> /dev/null
|
||||||
|
|
@ -75,27 +74,6 @@ fi
|
||||||
alias md='mkdir -p'
|
alias md='mkdir -p'
|
||||||
alias rd='rmdir'
|
alias rd='rmdir'
|
||||||
|
|
||||||
# Common misspellings of bash-it
|
|
||||||
alias shit='bash-it'
|
|
||||||
alias batshit='bash-it'
|
|
||||||
alias bashit='bash-it'
|
|
||||||
alias batbsh='bash-it'
|
|
||||||
alias babsh='bash-it'
|
|
||||||
alias bash_it='bash-it'
|
|
||||||
alias bash_ti='bash-it'
|
|
||||||
|
|
||||||
# Additional bash-it aliases for help/show
|
|
||||||
alias bshsa='bash-it show aliases'
|
|
||||||
alias bshsc='bash-it show completions'
|
|
||||||
alias bshsp='bash-it show plugins'
|
|
||||||
alias bshha='bash-it help aliases'
|
|
||||||
alias bshhc='bash-it help completions'
|
|
||||||
alias bshhp='bash-it help plugins'
|
|
||||||
alias bshsch="bash-it search"
|
|
||||||
alias bshenp="bash-it enable plugin"
|
|
||||||
alias bshena="bash-it enable alias"
|
|
||||||
alias bshenc="bash-it enable completion"
|
|
||||||
|
|
||||||
# Shorten extract
|
# Shorten extract
|
||||||
alias xt="extract"
|
alias xt="extract"
|
||||||
|
|
||||||
|
|
@ -113,3 +91,12 @@ catt() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The Bash-it aliases were moved to the `bash-it.aliases.bash` file. The intent of this
|
||||||
|
# is to keep the script readable and less bloated. If you don't need to use
|
||||||
|
# the `general` aliases, but you want the Bash-it aliases, you can disable the `general`
|
||||||
|
# aliases and enable just the ones for Bash-it explicitly:
|
||||||
|
# bash-it disable alias general
|
||||||
|
# bash-it enable alias bash-it
|
||||||
|
# shellcheck source=./bash-it.aliases.bash
|
||||||
|
source "$BASH_IT/aliases/available/bash-it.aliases.bash"
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,14 @@ alias gs='git status'
|
||||||
alias gss='git status -s'
|
alias gss='git status -s'
|
||||||
alias gsu='git submodule update --init --recursive'
|
alias gsu='git submodule update --init --recursive'
|
||||||
alias gl='git pull'
|
alias gl='git pull'
|
||||||
|
alias gpl='git pull'
|
||||||
alias glum='git pull upstream master'
|
alias glum='git pull upstream master'
|
||||||
alias gpr='git pull --rebase'
|
alias gpr='git pull --rebase'
|
||||||
alias gpp='git pull && git push'
|
alias gpp='git pull && git push'
|
||||||
alias gup='git fetch && git rebase'
|
alias gup='git fetch && git rebase'
|
||||||
alias gp='git push'
|
alias gp='git push'
|
||||||
alias gpo='git push origin'
|
alias gpd='git push --delete'
|
||||||
|
alias gpo='git push origin HEAD'
|
||||||
alias gpu='git push --set-upstream'
|
alias gpu='git push --set-upstream'
|
||||||
alias gpuo='git push --set-upstream origin'
|
alias gpuo='git push --set-upstream origin'
|
||||||
alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
|
alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
|
||||||
|
|
@ -35,26 +37,35 @@ alias gpom='git push origin master'
|
||||||
alias gr='git remote'
|
alias gr='git remote'
|
||||||
alias grv='git remote -v'
|
alias grv='git remote -v'
|
||||||
alias gra='git remote add'
|
alias gra='git remote add'
|
||||||
|
alias grb='git rebase'
|
||||||
|
alias grm='git rebase master'
|
||||||
|
alias grmi='git rebase master -i'
|
||||||
alias gd='git diff'
|
alias gd='git diff'
|
||||||
alias gds='git diff --staged'
|
alias gds='git diff --staged'
|
||||||
|
alias gdt='git difftool'
|
||||||
alias gdv='git diff -w "$@" | vim -R -'
|
alias gdv='git diff -w "$@" | vim -R -'
|
||||||
alias gc='git commit -v'
|
alias gc='git commit -v'
|
||||||
alias gca='git commit -v -a'
|
alias gca='git commit -v -a'
|
||||||
alias gcm='git commit -v -m'
|
alias gcm='git commit -v -m'
|
||||||
alias gcam="git commit -v -am"
|
alias gcam="git commit -v -am"
|
||||||
alias gci='git commit --interactive'
|
alias gci='git commit --interactive'
|
||||||
|
alias gcamd='git commit --amend'
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
|
# FROM https://stackoverflow.com/a/58623139/10362396
|
||||||
|
alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC'
|
||||||
alias gbt='git branch --track'
|
alias gbt='git branch --track'
|
||||||
alias gbm='git branch -m'
|
alias gbm='git branch -m'
|
||||||
alias gbd='git branch -d'
|
alias gbd='git branch -d'
|
||||||
alias gbD='git branch -D'
|
alias gbD='git branch -D'
|
||||||
alias gcount='git shortlog -sn'
|
alias gcount='git shortlog -sn'
|
||||||
alias gcp='git cherry-pick'
|
alias gcp='git cherry-pick'
|
||||||
|
alias gcpx='git cherry-pick -x'
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
alias gcom='git checkout master'
|
alias gcom='git checkout master'
|
||||||
alias gcb='git checkout -b'
|
alias gcb='git checkout -b'
|
||||||
alias gcob='git checkout -b'
|
alias gcob='git checkout -b'
|
||||||
|
alias gcobu='git checkout -b ${USER}/'
|
||||||
alias gct='git checkout --track'
|
alias gct='git checkout --track'
|
||||||
alias gcpd='git checkout master; git pull; git branch -D'
|
alias gcpd='git checkout master; git pull; git branch -D'
|
||||||
alias gexport='git archive --format zip --output'
|
alias gexport='git archive --format zip --output'
|
||||||
|
|
@ -62,7 +73,9 @@ alias gdel='git branch -D'
|
||||||
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
|
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
|
||||||
alias gll='git log --graph --pretty=oneline --abbrev-commit'
|
alias gll='git log --graph --pretty=oneline --abbrev-commit'
|
||||||
alias gg="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative"
|
alias gg="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative"
|
||||||
|
alias ggf="git log --graph --date=short --pretty=format:'%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'"
|
||||||
alias ggs="gg --stat"
|
alias ggs="gg --stat"
|
||||||
|
alias gsh="git show"
|
||||||
alias gsl="git shortlog -sn"
|
alias gsl="git shortlog -sn"
|
||||||
alias gwc="git whatchanged"
|
alias gwc="git whatchanged"
|
||||||
alias gt="git tag"
|
alias gt="git tag"
|
||||||
|
|
@ -75,17 +88,45 @@ alias gpatch="git format-patch -1"
|
||||||
alias gnew="git log HEAD@{1}..HEAD@{0}"
|
alias gnew="git log HEAD@{1}..HEAD@{0}"
|
||||||
# Add uncommitted and unstaged changes to the last commit
|
# Add uncommitted and unstaged changes to the last commit
|
||||||
alias gcaa="git commit -a --amend -C HEAD"
|
alias gcaa="git commit -a --amend -C HEAD"
|
||||||
|
# Rebase with latest remote master
|
||||||
|
alias gprom="git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master"
|
||||||
|
alias gpf="git push --force"
|
||||||
|
alias gpunch="git push --force-with-lease"
|
||||||
alias ggui="git gui"
|
alias ggui="git gui"
|
||||||
alias gcsam="git commit -S -am"
|
alias gcsam="git commit -S -am"
|
||||||
|
# Stash aliases
|
||||||
alias gst="git stash"
|
alias gst="git stash"
|
||||||
alias gstb="git stash branch"
|
alias gstb="git stash branch"
|
||||||
alias gstd="git stash drop"
|
alias gstd="git stash drop"
|
||||||
alias gstl="git stash list"
|
alias gstl="git stash list"
|
||||||
|
# Push introduced in git v2.13.2
|
||||||
|
alias gstpu="git stash push"
|
||||||
|
alias gstpum="git stash push -m"
|
||||||
|
# Save deprecated since git v2.16.0
|
||||||
|
# - aliases now resolve to push
|
||||||
|
alias gsts="git stash push"
|
||||||
|
alias gstsm="git stash push -m"
|
||||||
|
# Alias gstpo added for symmetry with gstpu (push)
|
||||||
|
# - gstp remains as alias for pop due to long-standing usage
|
||||||
|
alias gstpo="git stash pop"
|
||||||
alias gstp="git stash pop"
|
alias gstp="git stash pop"
|
||||||
alias gh='cd "$(git rev-parse --show-toplevel)"'
|
# Switch aliases - Requires git v2.23+
|
||||||
|
alias gsw="git switch"
|
||||||
|
alias gswm="git switch master"
|
||||||
|
alias gswc="git switch --create"
|
||||||
|
alias gswt="git switch --track"
|
||||||
|
# Git home
|
||||||
|
alias ghm='cd "$(git rev-parse --show-toplevel)"'
|
||||||
|
if ! _command_exists gh; then
|
||||||
|
alias gh='ghm'
|
||||||
|
fi
|
||||||
# Show untracked files
|
# Show untracked files
|
||||||
alias gu='git ls-files . --exclude-standard --others'
|
alias gu='git ls-files . --exclude-standard --others'
|
||||||
|
|
||||||
|
# Git SVN
|
||||||
|
alias gsr='git svn rebase'
|
||||||
|
alias gsd='git svn dcommit'
|
||||||
|
|
||||||
case $OSTYPE in
|
case $OSTYPE in
|
||||||
darwin*)
|
darwin*)
|
||||||
alias gtls="git tag -l | gsort -V"
|
alias gtls="git tag -l | gsort -V"
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,9 @@
|
||||||
cite 'about-alias'
|
cite 'about-alias'
|
||||||
about-alias 'kubectl aliases'
|
about-alias 'kubectl aliases'
|
||||||
|
|
||||||
# set apt aliases
|
|
||||||
function _set_pkg_aliases()
|
function _set_pkg_aliases()
|
||||||
{
|
{
|
||||||
if [ -x $(which kubectl) ]; then
|
if _command_exists kubectl; then
|
||||||
alias kc='kubectl'
|
alias kc='kubectl'
|
||||||
alias kcgp='kubectl get pods'
|
alias kcgp='kubectl get pods'
|
||||||
alias kcgd='kubectl get deployments'
|
alias kcgd='kubectl get deployments'
|
||||||
|
|
@ -18,6 +17,8 @@ function _set_pkg_aliases()
|
||||||
alias kcdn='kubectl describe node'
|
alias kcdn='kubectl describe node'
|
||||||
alias kcgpan='kubectl get pods --all-namespaces'
|
alias kcgpan='kubectl get pods --all-namespaces'
|
||||||
alias kcgdan='kubectl get deployments --all-namespaces'
|
alias kcgdan='kubectl get deployments --all-namespaces'
|
||||||
|
# launches a disposable netshoot pod in the k8s cluster
|
||||||
|
alias kcnetshoot='kubectl run --generator=run-pod/v1 netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
cite 'about-alias'
|
||||||
|
about-alias 'the Node.js environment aliases'
|
||||||
|
|
||||||
|
# alias to setup nodejs development environment
|
||||||
|
alias node-dev='export NODE_ENV=development'
|
||||||
|
|
||||||
|
# alias to setup nodejs production environment
|
||||||
|
alias node-prod='export NODE_ENV=production'
|
||||||
|
|
@ -2,6 +2,8 @@ cite 'about-alias'
|
||||||
about-alias 'common npm abbreviations'
|
about-alias 'common npm abbreviations'
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
|
|
||||||
|
# npm
|
||||||
alias ni='npm install'
|
alias ni='npm install'
|
||||||
alias nis='npm install --save'
|
alias nis='npm install --save'
|
||||||
alias nid='npm install --save-dev'
|
alias nid='npm install --save-dev'
|
||||||
|
|
@ -20,3 +22,21 @@ alias nud='npm update'
|
||||||
alias nr='npm run'
|
alias nr='npm run'
|
||||||
alias nls='npm list --depth=0 2>/dev/null'
|
alias nls='npm list --depth=0 2>/dev/null'
|
||||||
alias nlsg='npm list -g --depth=0 2>/dev/null'
|
alias nlsg='npm list -g --depth=0 2>/dev/null'
|
||||||
|
|
||||||
|
# npx
|
||||||
|
alias nx='npx'
|
||||||
|
alias nxplease='npx $(fc -ln -1)'
|
||||||
|
alias nxn='npx --no-install '
|
||||||
|
alias nxp='npx -p '
|
||||||
|
alias nxnp='npx --no-install -p '
|
||||||
|
alias nxq='npx -q '
|
||||||
|
alias nxnq='npx --no-install -q '
|
||||||
|
alias nxqp='npx -q -p '
|
||||||
|
alias nxnqp='npx --no-install -q -p '
|
||||||
|
alias nxni='npx --no-install --ignore-existing '
|
||||||
|
alias nxip='npx --ignore-existing -p '
|
||||||
|
alias nxnip='npx --no-install --ignore-existing -p '
|
||||||
|
alias nxqi='npx -q --ignore-existing '
|
||||||
|
alias nxniq='npx --no-install --ignore-existing -q '
|
||||||
|
alias nxiqp='npx --ignore-existing -q -p '
|
||||||
|
alias nxniqp='npx --no-install --ignore-existing -q -p '
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,3 @@ alias puplint="puppet-lint *.pp"
|
||||||
alias pupagt="puppet agent -t"
|
alias pupagt="puppet agent -t"
|
||||||
alias pupagtd="puppet agent -t --debug"
|
alias pupagtd="puppet agent -t --debug"
|
||||||
alias pupapp="puppet apply"
|
alias pupapp="puppet apply"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Aliases for Terraform and Terragrunt
|
||||||
|
|
||||||
|
cite 'about-alias'
|
||||||
|
about-alias 'Terraform abbreviations'
|
||||||
|
|
||||||
|
alias tf='terraform'
|
||||||
|
alias tfv='terraform validate'
|
||||||
|
alias tfp='terraform plan'
|
||||||
|
alias tfa='terraform apply'
|
||||||
|
alias tfd='terraform destory'
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Aliases for Terraform and Terragrunt
|
||||||
|
|
||||||
|
cite 'about-alias'
|
||||||
|
about-alias 'Terragrunt abbreviations'
|
||||||
|
|
||||||
|
alias tg='terragrunt'
|
||||||
|
alias tgv='terragrunt validate'
|
||||||
|
alias tgp='terragrunt plan'
|
||||||
|
alias tga='terragrunt apply'
|
||||||
|
alias tgd='terragrunt destroy'
|
||||||
|
|
||||||
|
alias tgva='terragrunt validate-all'
|
||||||
|
alias tgpa='terragrunt plan-all'
|
||||||
|
alias tgaa='terragrunt apply-all'
|
||||||
|
alias tgda='terragrunt destroy-all'
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
cite 'uuid-alias'
|
||||||
|
about-alias 'uuidgen aliases'
|
||||||
|
|
||||||
|
if _command_exists uuid; then # Linux
|
||||||
|
alias uuidu="uuid | tr '[:lower:]' '[:upper:]'"
|
||||||
|
alias uuidl=uuid
|
||||||
|
elif _command_exists uuidgen; then # macOS/BSD
|
||||||
|
alias uuidu="uuidgen"
|
||||||
|
alias uuid="uuidgen | tr '[:upper:]' '[:lower:]'" # because upper case is like YELLING
|
||||||
|
alias uuidl=uuid
|
||||||
|
fi
|
||||||
47
bash_it.sh
47
bash_it.sh
|
|
@ -1,37 +1,49 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Initialize Bash It
|
# Initialize Bash It
|
||||||
|
BASH_IT_LOG_PREFIX="core: main: "
|
||||||
|
|
||||||
# Only set $BASH_IT if it's not already set
|
# Only set $BASH_IT if it's not already set
|
||||||
if [ -z "$BASH_IT" ];
|
if [ -z "$BASH_IT" ];
|
||||||
then
|
then
|
||||||
# Setting $BASH to maintain backwards compatibility
|
# Setting $BASH to maintain backwards compatibility
|
||||||
# TODO: warn users that they should upgrade their .bash_profile
|
|
||||||
export BASH_IT=$BASH
|
export BASH_IT=$BASH
|
||||||
BASH="$(bash -c 'echo $BASH')"
|
BASH="$(bash -c 'echo $BASH')"
|
||||||
export BASH
|
export BASH
|
||||||
fi
|
BASH_IT_OLD_BASH_SETUP=true
|
||||||
|
|
||||||
# For backwards compatibility, look in old BASH_THEME location
|
|
||||||
if [ -z "$BASH_IT_THEME" ];
|
|
||||||
then
|
|
||||||
# TODO: warn users that they should upgrade their .bash_profile
|
|
||||||
export BASH_IT_THEME="$BASH_THEME";
|
|
||||||
unset BASH_THEME;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load composure first, so we support function metadata
|
# Load composure first, so we support function metadata
|
||||||
# shellcheck source=./lib/composure.bash
|
# shellcheck source=./lib/composure.bash
|
||||||
source "${BASH_IT}/lib/composure.bash"
|
source "${BASH_IT}/lib/composure.bash"
|
||||||
|
# We need to load logging module first as well in order to be able to log
|
||||||
|
# shellcheck source=./lib/log.bash
|
||||||
|
source "${BASH_IT}/lib/log.bash"
|
||||||
|
|
||||||
|
# We can only log it now
|
||||||
|
[ -z "$BASH_IT_OLD_BASH_SETUP" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"
|
||||||
|
|
||||||
|
# For backwards compatibility, look in old BASH_THEME location
|
||||||
|
if [ -z "$BASH_IT_THEME" ];
|
||||||
|
then
|
||||||
|
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
|
||||||
|
export BASH_IT_THEME="$BASH_THEME";
|
||||||
|
unset BASH_THEME;
|
||||||
|
fi
|
||||||
|
|
||||||
# support 'plumbing' metadata
|
# support 'plumbing' metadata
|
||||||
cite _about _param _example _group _author _version
|
cite _about _param _example _group _author _version
|
||||||
|
|
||||||
# libraries, but skip appearance (themes) for now
|
# libraries, but skip appearance (themes) for now
|
||||||
|
_log_debug "Loading libraries(except appearance)..."
|
||||||
LIB="${BASH_IT}/lib/*.bash"
|
LIB="${BASH_IT}/lib/*.bash"
|
||||||
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
|
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
|
||||||
for _bash_it_config_file in $LIB
|
for _bash_it_config_file in $LIB
|
||||||
do
|
do
|
||||||
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then
|
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then
|
||||||
|
filename=${_bash_it_config_file##*/}
|
||||||
|
filename=${filename%.bash}
|
||||||
|
BASH_IT_LOG_PREFIX="lib: ${filename}: "
|
||||||
|
_log_debug "Loading library file..."
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$_bash_it_config_file"
|
source "$_bash_it_config_file"
|
||||||
fi
|
fi
|
||||||
|
|
@ -51,36 +63,51 @@ done
|
||||||
|
|
||||||
# Load theme, if a theme was set
|
# Load theme, if a theme was set
|
||||||
if [[ ! -z "${BASH_IT_THEME}" ]]; then
|
if [[ ! -z "${BASH_IT_THEME}" ]]; then
|
||||||
|
_log_debug "Loading \"${BASH_IT_THEME}\" theme..."
|
||||||
# Load colors and helpers first so they can be used in base theme
|
# Load colors and helpers first so they can be used in base theme
|
||||||
|
BASH_IT_LOG_PREFIX="themes: colors: "
|
||||||
# shellcheck source=./themes/colors.theme.bash
|
# shellcheck source=./themes/colors.theme.bash
|
||||||
source "${BASH_IT}/themes/colors.theme.bash"
|
source "${BASH_IT}/themes/colors.theme.bash"
|
||||||
|
BASH_IT_LOG_PREFIX="themes: githelpers: "
|
||||||
# shellcheck source=./themes/githelpers.theme.bash
|
# shellcheck source=./themes/githelpers.theme.bash
|
||||||
source "${BASH_IT}/themes/githelpers.theme.bash"
|
source "${BASH_IT}/themes/githelpers.theme.bash"
|
||||||
|
BASH_IT_LOG_PREFIX="themes: p4helpers: "
|
||||||
# shellcheck source=./themes/p4helpers.theme.bash
|
# shellcheck source=./themes/p4helpers.theme.bash
|
||||||
source "${BASH_IT}/themes/p4helpers.theme.bash"
|
source "${BASH_IT}/themes/p4helpers.theme.bash"
|
||||||
|
BASH_IT_LOG_PREFIX="themes: base: "
|
||||||
# shellcheck source=./themes/base.theme.bash
|
# shellcheck source=./themes/base.theme.bash
|
||||||
source "${BASH_IT}/themes/base.theme.bash"
|
source "${BASH_IT}/themes/base.theme.bash"
|
||||||
|
|
||||||
|
BASH_IT_LOG_PREFIX="lib: appearance: "
|
||||||
# appearance (themes) now, after all dependencies
|
# appearance (themes) now, after all dependencies
|
||||||
# shellcheck source=./lib/appearance.bash
|
# shellcheck source=./lib/appearance.bash
|
||||||
source "$APPEARANCE_LIB"
|
source "$APPEARANCE_LIB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load custom aliases, completion, plugins
|
BASH_IT_LOG_PREFIX="core: main: "
|
||||||
|
_log_debug "Loading custom aliases, completion, plugins..."
|
||||||
for file_type in "aliases" "completion" "plugins"
|
for file_type in "aliases" "completion" "plugins"
|
||||||
do
|
do
|
||||||
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]
|
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]
|
||||||
then
|
then
|
||||||
|
BASH_IT_LOG_PREFIX="${file_type}: custom: "
|
||||||
|
_log_debug "Loading component..."
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${BASH_IT}/${file_type}/custom.${file_type}.bash"
|
source "${BASH_IT}/${file_type}/custom.${file_type}.bash"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
|
BASH_IT_LOG_PREFIX="core: main: "
|
||||||
|
_log_debug "Loading general custom files..."
|
||||||
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
|
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
|
||||||
for _bash_it_config_file in $CUSTOM
|
for _bash_it_config_file in $CUSTOM
|
||||||
do
|
do
|
||||||
if [ -e "${_bash_it_config_file}" ]; then
|
if [ -e "${_bash_it_config_file}" ]; then
|
||||||
|
filename=$(basename "${_bash_it_config_file}")
|
||||||
|
filename=${filename%*.bash}
|
||||||
|
BASH_IT_LOG_PREFIX="custom: $filename: "
|
||||||
|
_log_debug "Loading custom file..."
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$_bash_it_config_file"
|
source "$_bash_it_config_file"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
#######################################################################
|
||||||
|
# Allow-list of files to be lint-checked by CI
|
||||||
|
#
|
||||||
|
# Directory Suport
|
||||||
|
# Directory references are allowed within the file, ie:
|
||||||
|
#
|
||||||
|
# themes/powerline
|
||||||
|
#
|
||||||
|
# All files under the referenced directory will be checked
|
||||||
|
#
|
||||||
|
# Checking Files Locally
|
||||||
|
# You can manually invoke the check via:
|
||||||
|
#
|
||||||
|
# lint_clean_files.sh
|
||||||
|
#
|
||||||
|
|
||||||
|
# root directories
|
||||||
|
#
|
||||||
|
docs
|
||||||
|
|
||||||
|
# root files
|
||||||
|
#
|
||||||
|
.gitattributes
|
||||||
|
lint_clean_files.sh
|
||||||
|
|
||||||
|
# themes
|
||||||
|
#
|
||||||
|
themes/90210
|
||||||
|
themes/powerline
|
||||||
|
|
||||||
|
# completions
|
||||||
|
#
|
||||||
|
completion/available/cargo.completion.bash
|
||||||
|
completion/available/knife.completion.bash
|
||||||
|
completion/available/pipx.completion.bash
|
||||||
|
completion/available/rustup.completion.bash
|
||||||
|
|
@ -65,7 +65,7 @@ _bash-it-comp()
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
chose_opt="${COMP_WORDS[1]}"
|
chose_opt="${COMP_WORDS[1]}"
|
||||||
file_type="${COMP_WORDS[2]}"
|
file_type="${COMP_WORDS[2]}"
|
||||||
opts="disable enable help migrate reload search show update version"
|
opts="disable enable help migrate reload restart doctor search show update version"
|
||||||
case "${chose_opt}" in
|
case "${chose_opt}" in
|
||||||
show)
|
show)
|
||||||
local show_args="aliases completions plugins"
|
local show_args="aliases completions plugins"
|
||||||
|
|
@ -82,7 +82,21 @@ _bash-it-comp()
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
migrate | reload | search | update | version)
|
doctor)
|
||||||
|
local doctor_args="errors warnings all"
|
||||||
|
COMPREPLY=( $(compgen -W "${doctor_args}" -- ${cur}) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
update)
|
||||||
|
if [[ ${cur} == -* ]];then
|
||||||
|
local update_args="-s --silent"
|
||||||
|
else
|
||||||
|
local update_args="stable dev"
|
||||||
|
fi
|
||||||
|
COMPREPLY=( $(compgen -W "${update_args}" -- ${cur}) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
migrate | reload | search | version)
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
enable | disable)
|
enable | disable)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,27 @@
|
||||||
if which brew >/dev/null 2>&1; then
|
#!/usr/bin/env bash
|
||||||
BREW_PREFIX=$(brew --prefix)
|
|
||||||
|
|
||||||
if [ -f "$BREW_PREFIX"/etc/bash_completion.d/brew ]; then
|
# Load late to make sure `system` completion loads first
|
||||||
. "$BREW_PREFIX"/etc/bash_completion.d/brew
|
# BASH_IT_LOAD_PRIORITY: 375
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" != 'Darwin' ]] ; then
|
||||||
|
_log_warning "unsupported operating system - only 'Darwin' is supported"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]; then
|
# Make sure brew is installed
|
||||||
. "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh
|
_command_exists brew || return 0
|
||||||
fi
|
|
||||||
|
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}
|
||||||
|
|
||||||
|
if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]] ; then
|
||||||
|
source "$BREW_PREFIX"/etc/bash_completion.d/brew
|
||||||
|
|
||||||
|
elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]] ; then
|
||||||
|
source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh
|
||||||
|
|
||||||
|
elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]] ; then
|
||||||
|
# For the git-clone based installation, see here for more info:
|
||||||
|
# https://github.com/Bash-it/bash-it/issues/1458
|
||||||
|
# https://docs.brew.sh/Shell-Completion
|
||||||
|
source "$BREW_PREFIX"/completions/bash/brew
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#! bash
|
#! bash
|
||||||
# bash completion for the `bundle` command.
|
# bash completion for the `bundle` command.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011-2013 Daniel Luz <dev at mernen dot com>.
|
# Copyright (c) 2011-2017 Daniel Luz <dev at mernen dot com>.
|
||||||
# Distributed under the MIT license.
|
# Distributed under the MIT license.
|
||||||
# http://mernen.com/projects/completion-ruby
|
# http://mernen.com/projects/completion-ruby
|
||||||
#
|
#
|
||||||
|
|
@ -9,28 +9,166 @@
|
||||||
# . completion-bundle
|
# . completion-bundle
|
||||||
|
|
||||||
__bundle() {
|
__bundle() {
|
||||||
local cur=$2
|
local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "$1")
|
||||||
local prev=$3
|
local cur prev
|
||||||
|
_get_comp_words_by_ref -n : cur prev
|
||||||
local bundle_command
|
local bundle_command
|
||||||
|
local bundle_command_index
|
||||||
__bundle_get_command
|
__bundle_get_command
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
||||||
local options
|
local options
|
||||||
if [[ $cur = -* ]]; then
|
if [[ $cur = -* && $bundle_command != exec ]]; then
|
||||||
options="--no-color --verbose"
|
options="-V --help --no-color --no-no-color --verbose --no-verbose"
|
||||||
if [[ -z $bundle_command ]]; then
|
case $bundle_command in
|
||||||
options="$options --version --help"
|
"")
|
||||||
fi
|
options="$options --version";;
|
||||||
elif [[ $bundle_command = "exec" ]]; then
|
check)
|
||||||
_bundle_exec_completions
|
options="$options --dry-run --gemfile --path -r --retry";;
|
||||||
return
|
clean)
|
||||||
|
options="$options --dry-run --force";;
|
||||||
|
config)
|
||||||
|
options="$options --local --global --delete";;
|
||||||
|
doctor)
|
||||||
|
options="$options --gemfile --quiet --no-quiet";;
|
||||||
|
gem)
|
||||||
|
options="$options -b -e -t --bin --coc --no-coc --edit --exe
|
||||||
|
--no-exe --ext --no-ext --mit --no-mit --test";;
|
||||||
|
init)
|
||||||
|
options="$options --gemspec";;
|
||||||
|
install)
|
||||||
|
options="$options --binstubs --clean --deployment --force --frozen
|
||||||
|
--full-index --gemfile --jobs --local --no-cache
|
||||||
|
--no-prune --path --quiet --retry --shebang --standalone
|
||||||
|
--system --trust-policy --with --without";;
|
||||||
|
lock)
|
||||||
|
options="$options --add-platform --conservative --full-index
|
||||||
|
--local --lockfile --major --minor --patch --print
|
||||||
|
--remove-platform --strict --update";;
|
||||||
|
package)
|
||||||
|
options="$options --all --all-platforms";;
|
||||||
|
platform)
|
||||||
|
options="$options --ruby";;
|
||||||
|
show)
|
||||||
|
options="$options --outdated --paths --no-paths";;
|
||||||
|
update)
|
||||||
|
options="$options --bundler --conservative --force --full-index
|
||||||
|
--group --jobs --local --major --minor --patch --quiet
|
||||||
|
--ruby --source --strict";;
|
||||||
|
viz)
|
||||||
|
options="$options -f -F -R -v -W --file --format --requirements
|
||||||
|
--no-requirements --version --no-version --without";;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
if [[ -z $bundle_command || $bundle_command = help ]]; then
|
case $bundle_command in
|
||||||
options="help install update package exec config check list show
|
"" | help)
|
||||||
console open viz init gem"
|
options="help install update package exec config
|
||||||
|
check show outdated console open lock viz init gem
|
||||||
|
platform clean doctor"
|
||||||
|
;;
|
||||||
|
check | install)
|
||||||
|
case $prev in
|
||||||
|
--binstubs | --path)
|
||||||
|
_filedir -d
|
||||||
|
return;;
|
||||||
|
--standalone | --with | --without)
|
||||||
|
__bundle_complete_groups
|
||||||
|
return;;
|
||||||
|
--trust-policy)
|
||||||
|
options="HighSecurity MediumSecurity LowSecurity
|
||||||
|
AlmostNoSecurity NoSecurity";;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
config)
|
||||||
|
case $prev in
|
||||||
|
config | --*)
|
||||||
|
case $cur in
|
||||||
|
local.*)
|
||||||
|
options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys'))
|
||||||
|
options=("${options[*]/#/local.}")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
options=(path frozen without bin gemfile ssl_ca_cert
|
||||||
|
ssl_client_cert cache_path disable_multisource
|
||||||
|
ignore_messages retry redirect timeout
|
||||||
|
force_ruby_platform specific_platform
|
||||||
|
disable_checksum_validation disable_version_check
|
||||||
|
allow_offline_install auto_install
|
||||||
|
cache_all_platforms cache_all clean console
|
||||||
|
disable_exec_load disable_local_branch_check
|
||||||
|
disable_shared_gems jobs major_deprecations
|
||||||
|
no_install no_prune only_update_to_newer_versions
|
||||||
|
plugins shebang silence_root_warning
|
||||||
|
ssl_verify_mode system_bindir user_agent)
|
||||||
|
# We want to suggest the options above as complete words,
|
||||||
|
# and also "local." and "mirror." as prefixes
|
||||||
|
# To achieve that, disable automatic space insertion,
|
||||||
|
# insert it manually, then add the non-spaced prefixes
|
||||||
|
compopt -o nospace
|
||||||
|
options=("${options[@]/%/ }")
|
||||||
|
# And add prefix suggestions
|
||||||
|
options+=(local. mirror.)
|
||||||
|
# Override $IFS for completion to work
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=($(compgen -W '${options[@]}' -- "$cur"))
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
path | local.*)
|
||||||
|
_filedir -d
|
||||||
|
return;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
exec)
|
||||||
|
if [[ $COMP_CWORD -eq $bundle_command_index ]]; then
|
||||||
|
# Figure out Bundler's binaries dir
|
||||||
|
local bundler_bin=$(__bundle_exec_ruby 'puts Bundler.bundle_path + "bin"')
|
||||||
|
if [[ -d $bundler_bin ]]; then
|
||||||
|
local binaries=("$bundler_bin"/*)
|
||||||
|
# If there are binaries, strip directory name and use them
|
||||||
|
[[ -f "$binaries" ]] && options="${binaries[@]##*/}"
|
||||||
|
else
|
||||||
|
# No binaries found; use full command completion
|
||||||
|
COMPREPLY=($(compgen -c -- "$cur"))
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
local _RUBY_COMMAND_PREFIX=("${bundle_bin[@]}" exec)
|
||||||
|
_command_offset $bundle_command_index
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
COMPREPLY=($(compgen -W "$options" -- "$cur"))
|
;;
|
||||||
|
gem)
|
||||||
|
case $prev in
|
||||||
|
-e | --edit)
|
||||||
|
COMPREPLY=($(compgen -c -- "$cur"))
|
||||||
|
return;;
|
||||||
|
-t | --test)
|
||||||
|
options="minitest rspec";;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
update)
|
||||||
|
case $prev in
|
||||||
|
--group)
|
||||||
|
__bundle_complete_groups
|
||||||
|
return;;
|
||||||
|
*)
|
||||||
|
options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys'))
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
viz)
|
||||||
|
case $prev in
|
||||||
|
-F | --format)
|
||||||
|
options="dot jpg png svg";;
|
||||||
|
-W | --without)
|
||||||
|
__bundle_complete_groups
|
||||||
|
return;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
|
||||||
}
|
}
|
||||||
|
|
||||||
__bundle_get_command() {
|
__bundle_get_command() {
|
||||||
|
|
@ -41,25 +179,76 @@ __bundle_get_command() {
|
||||||
case $arg in
|
case $arg in
|
||||||
[^-]*)
|
[^-]*)
|
||||||
bundle_command=$arg
|
bundle_command=$arg
|
||||||
|
bundle_command_index=$((i + 1))
|
||||||
return;;
|
return;;
|
||||||
--version)
|
--version)
|
||||||
# command-killer
|
# Command-killer
|
||||||
bundle_command=-
|
bundle_command=-
|
||||||
return;;
|
return;;
|
||||||
--help)
|
--help)
|
||||||
bundle_command=help
|
bundle_command=help
|
||||||
|
bundle_command_index=$((i + 1))
|
||||||
return;;
|
return;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Provides completion for Bundler group names.
|
||||||
|
#
|
||||||
|
# Multiple groups can be entered, separated either by spaces or by colons.
|
||||||
|
# Input is read from $cur, and the result is directly written to $COMPREPLY.
|
||||||
|
__bundle_complete_groups() {
|
||||||
|
# Group being currently written
|
||||||
|
local cur_group=${cur##*[ :]}
|
||||||
|
# All groups written before
|
||||||
|
local prefix=${cur%"$cur_group"}
|
||||||
|
local groups=$(__bundle_exec_ruby 'puts Bundler.definition.dependencies.map(&:groups).reduce(:|).map(&:to_s)')
|
||||||
|
if [[ ! $groups ]]; then
|
||||||
|
COMPREPLY=()
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# Duplicate "default" and anything already in $prefix, so that `uniq`
|
||||||
|
# strips it; groups may be separated by ':', ' ', or '\ '
|
||||||
|
local excluded=$'\ndefault\n'${prefix//[: \'\"\\]/$'\n'}
|
||||||
|
# Include them twice to ensure they are duplicates
|
||||||
|
groups=$groups$excluded$excluded
|
||||||
|
COMPREPLY=($(compgen -W "$(sort <<<"$groups" | uniq -u)" -- "$cur_group"))
|
||||||
|
# Prepend prefix to all entries
|
||||||
|
COMPREPLY=("${COMPREPLY[@]/#/$prefix}")
|
||||||
|
__ltrim_colon_completions "$cur"
|
||||||
|
}
|
||||||
|
|
||||||
complete -F __bundle -o bashdefault -o default bundle
|
# __bundle_exec_ruby <script> [args...]
|
||||||
# vim: ai ft=sh sw=4 sts=2 et
|
#
|
||||||
|
# Runs a Ruby script with Bundler loaded.
|
||||||
|
# Results may be cached.
|
||||||
|
__bundle_exec_ruby() {
|
||||||
|
local bundle_bin=(${bundle_bin[@]:-bundle})
|
||||||
|
# Lockfile is inferred here, and might not be correct (for example, when
|
||||||
|
# running on a subdirectory). However, a wrong file path won't be a
|
||||||
|
# cadastrophic mistake; it just means the cache won't be invalidated when
|
||||||
|
# the local gem list changes (but will still invalidate if the command is
|
||||||
|
# run on another directory)
|
||||||
|
local lockfile=$PWD/Gemfile.lock
|
||||||
|
local cachedir=${XDG_CACHE_HOME:-~/.cache}/completion-ruby
|
||||||
|
local cachefile=$cachedir/bundle--exec-ruby
|
||||||
|
# A representation of all arguments with newlines replaced by spaces,
|
||||||
|
# to fit in a single line as a cache identifier
|
||||||
|
local cache_id_line="${bundle_bin[*]} @ $lockfile: ${*//$'\n'/ }"
|
||||||
|
|
||||||
_bundle_exec_completions()
|
if [[ (! -f $lockfile || $cachefile -nt $lockfile) &&
|
||||||
{
|
$(head -n 1 -- "$cachefile" 2>/dev/null) = "$cache_id_line" ]]; then
|
||||||
if [[ $COMP_CWORD = 2 ]]; then
|
tail -n +2 -- "$cachefile"
|
||||||
COMPREPLY=($(compgen -c -- "$2"))
|
else
|
||||||
|
local output=$("${bundle_bin[@]}" exec ruby -e "$@" 2>/dev/null)
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
(mkdir -p -- "$cachedir" &&
|
||||||
|
echo "$cache_id_line"$'\n'"$output" >$cachefile) 2>/dev/null
|
||||||
|
echo "$output"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
complete -F __bundle -o bashdefault -o default bundle
|
||||||
|
# vim: ai ft=sh sw=4 sts=4 et
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# cargo (Rust package manager) completion
|
||||||
|
|
||||||
|
if _binary_exists rustup && _binary_exists cargo; then
|
||||||
|
eval "$(rustup completions bash cargo)"
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# bash completion support for Hashicorp consul
|
||||||
|
|
||||||
|
CONSUL_BIN=$(command -v consul 2>/dev/null)
|
||||||
|
|
||||||
|
if [[ -x "$CONSUL_BIN" ]]
|
||||||
|
then
|
||||||
|
complete -C "$CONSUL_BIN" consul
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset CONSUL_BIN
|
||||||
|
|
@ -1,11 +1 @@
|
||||||
if which crystal >/dev/null 2>&1; then
|
_log_warning 'Bash completion for "crystal" is now covered by "system". This completion can be disabled.'
|
||||||
|
|
||||||
if which brew >/dev/null 2>&1; then
|
|
||||||
BREW_PREFIX=$(brew --prefix)
|
|
||||||
|
|
||||||
if [ -f "$BREW_PREFIX"/etc/bash_completion.d/crystal ]; then
|
|
||||||
. "$BREW_PREFIX"/etc/bash_completion.d/crystal
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -69,4 +69,3 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
complete -F _python_django_completion -o default $pythons
|
complete -F _python_django_completion -o default $pythons
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,9 @@
|
||||||
|
#/usr/bin/env bash
|
||||||
|
# Bash completion for Google Cloud SDK
|
||||||
|
|
||||||
|
if which gcloud >/dev/null 2>&1; then
|
||||||
|
GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")}
|
||||||
|
for i in $(ls ${GOOGLE_SDK_ROOT}/*.bash.inc); do
|
||||||
|
source $i
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
@ -1,366 +0,0 @@
|
||||||
# hub tab-completion script for bash.
|
|
||||||
# This script complements the completion script that ships with git.
|
|
||||||
|
|
||||||
# Check that git tab completion is available
|
|
||||||
if declare -F _git > /dev/null; then
|
|
||||||
# Duplicate and rename the 'list_all_commands' function
|
|
||||||
eval "$(declare -f __git_list_all_commands | \
|
|
||||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
|
||||||
|
|
||||||
# Wrap the 'list_all_commands' function with extra hub commands
|
|
||||||
__git_list_all_commands() {
|
|
||||||
cat <<-EOF
|
|
||||||
alias
|
|
||||||
pull-request
|
|
||||||
fork
|
|
||||||
create
|
|
||||||
browse
|
|
||||||
compare
|
|
||||||
ci-status
|
|
||||||
release
|
|
||||||
issue
|
|
||||||
update
|
|
||||||
EOF
|
|
||||||
__git_list_all_commands_without_hub
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure cached commands are cleared
|
|
||||||
__git_all_commands=""
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# hub command completions
|
|
||||||
##########################
|
|
||||||
|
|
||||||
# hub alias [-s] [SHELL]
|
|
||||||
_git_alias() {
|
|
||||||
local i c=2 s=-s sh shells="bash zsh sh ksh csh fish"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-s)
|
|
||||||
unset s
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
for sh in $shells; do
|
|
||||||
if [ "$sh" = "$i" ]; then
|
|
||||||
unset shells
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
__gitcomp "$s $shells"
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
|
|
||||||
_git_browse() {
|
|
||||||
local i c=2 u=-u repo subpage
|
|
||||||
local subpages_="commits issues tree wiki pulls branches stargazers
|
|
||||||
contributors network network/ graphs graphs/"
|
|
||||||
local subpages_network="members"
|
|
||||||
local subpages_graphs="commit-activity code-frequency punch-card"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-u)
|
|
||||||
unset u
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "$repo" ]; then
|
|
||||||
repo=$i
|
|
||||||
else
|
|
||||||
subpage=$i
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
if [ -z "$repo" ]; then
|
|
||||||
__gitcomp "$u -- $(__hub_github_repos '\p')"
|
|
||||||
elif [ -z "$subpage" ]; then
|
|
||||||
case "$cur" in
|
|
||||||
*/*)
|
|
||||||
local pfx="${cur%/*}" cur_="${cur#*/}"
|
|
||||||
local subpages_var="subpages_$pfx"
|
|
||||||
__gitcomp "${!subpages_var}" "$pfx/" "$cur_"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__gitcomp "$u ${subpages_}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
__gitcomp "$u"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
|
|
||||||
_git_compare() {
|
|
||||||
local i c=$((cword - 1)) u=-u user remote owner repo arg_repo rev
|
|
||||||
while [ $c -gt 1 ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-u)
|
|
||||||
unset u
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "$rev" ]; then
|
|
||||||
# Even though the logic below is able to complete both user/repo
|
|
||||||
# and revision in the right place, when there is only one argument
|
|
||||||
# (other than -u) in the command, that argument will be taken as
|
|
||||||
# revision. For example:
|
|
||||||
# $ hub compare -u upstream
|
|
||||||
# > https://github.com/USER/REPO/compare/upstream
|
|
||||||
if __hub_github_repos '\p' | grep -Eqx "^$i(/[^/]+)?"; then
|
|
||||||
arg_repo=$i
|
|
||||||
else
|
|
||||||
rev=$i
|
|
||||||
fi
|
|
||||||
elif [ -z "$arg_repo" ]; then
|
|
||||||
arg_repo=$i
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c--))
|
|
||||||
done
|
|
||||||
|
|
||||||
# Here we want to find out the git remote name of user/repo, in order to
|
|
||||||
# generate an appropriate revision list
|
|
||||||
if [ -z "$arg_repo" ]; then
|
|
||||||
user=$(__hub_github_user)
|
|
||||||
if [ -z "$user" ]; then
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
if [ "$remote" = origin ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
owner=${repo%%/*}
|
|
||||||
if [ "$user" = "$owner" ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
owner=${repo%%/*}
|
|
||||||
case "$arg_repo" in
|
|
||||||
"$repo"|"$owner")
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pfx cur_="$cur"
|
|
||||||
case "$cur_" in
|
|
||||||
*..*)
|
|
||||||
pfx="${cur_%%..*}..."
|
|
||||||
cur_="${cur_##*..}"
|
|
||||||
__gitcomp_nl "$(__hub_revlist $remote)" "$pfx" "$cur_"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "${arg_repo}${rev}" ]; then
|
|
||||||
__gitcomp "$u $(__hub_github_repos '\o\n\p') $(__hub_revlist $remote)"
|
|
||||||
elif [ -z "$rev" ]; then
|
|
||||||
__gitcomp "$u $(__hub_revlist $remote)"
|
|
||||||
else
|
|
||||||
__gitcomp "$u"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
|
|
||||||
_git_create() {
|
|
||||||
local i c=2 name repo flags="-p -d -h"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-d|-h)
|
|
||||||
((c++))
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
-p)
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
name=$i
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
if [ -z "$name" ]; then
|
|
||||||
repo=$(basename "$(pwd)")
|
|
||||||
fi
|
|
||||||
case "$prev" in
|
|
||||||
-d|-h)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
-p|*)
|
|
||||||
__gitcomp "$repo $flags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub fork [--no-remote]
|
|
||||||
_git_fork() {
|
|
||||||
local i c=2 remote=yes
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
--no-remote)
|
|
||||||
unset remote
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
if [ -n "$remote" ]; then
|
|
||||||
__gitcomp "--no-remote"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>]
|
|
||||||
_git_pull_request() {
|
|
||||||
local i c=2 flags="-f -m -F -i -b -h"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-m|-F|-i|-b|-h)
|
|
||||||
((c++))
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
-f)
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
case "$prev" in
|
|
||||||
-i)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
-b|-h)
|
|
||||||
# (Doesn't seem to need this...)
|
|
||||||
# Uncomment the following line when 'owner/repo:[TAB]' misbehaved
|
|
||||||
#_get_comp_words_by_ref -n : cur
|
|
||||||
__gitcomp_nl "$(__hub_heads)"
|
|
||||||
# __ltrim_colon_completions "$cur"
|
|
||||||
;;
|
|
||||||
-F)
|
|
||||||
COMPREPLY=( "$cur"* )
|
|
||||||
;;
|
|
||||||
-f|*)
|
|
||||||
__gitcomp "$flags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
###################
|
|
||||||
# Helper functions
|
|
||||||
###################
|
|
||||||
|
|
||||||
# __hub_github_user [HOST]
|
|
||||||
# Return $GITHUB_USER or the default github user defined in hub config
|
|
||||||
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
|
||||||
__hub_github_user() {
|
|
||||||
if [ -n "$GITHUB_USER" ]; then
|
|
||||||
echo $GITHUB_USER
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/gh}
|
|
||||||
if [ -f "$config" ]; then
|
|
||||||
while read line; do
|
|
||||||
if [ "$line" = "---" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
k=${line%%:*}
|
|
||||||
v=${line#*:}
|
|
||||||
if [ -z "$v" ]; then
|
|
||||||
if [ "$h" = "$host" ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
h=$k
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
k=${k#* }
|
|
||||||
v=${v#* }
|
|
||||||
if [ "$h" = "$host" ] && [ "$k" = "user" ]; then
|
|
||||||
echo "$v"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done < "$config"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# __hub_github_repos [FORMAT]
|
|
||||||
# List all github hosted repository
|
|
||||||
# FORMAT - Format string contains multiple of these:
|
|
||||||
# \m remote
|
|
||||||
# \p owner/repo
|
|
||||||
# \o owner
|
|
||||||
# escaped characters (\n, \t ...etc) work
|
|
||||||
# If omitted, prints all github repos in the format of "remote:owner/repo"
|
|
||||||
__hub_github_repos() {
|
|
||||||
local f format=$1
|
|
||||||
if [ -z "$(__gitdir)" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ -z "$format" ]; then
|
|
||||||
format='\1:\2'
|
|
||||||
else
|
|
||||||
format=${format//\m/\1}
|
|
||||||
format=${format//\p/\2}
|
|
||||||
format=${format//\o/\3}
|
|
||||||
fi
|
|
||||||
command git config --get-regexp 'remote\.[^.]*\.url' |
|
|
||||||
grep -E ' ((https?|git)://|git@)github\.com[:/][^:/]+/[^/]+$' |
|
|
||||||
sed -E 's#^remote\.([^.]+)\.url +.+[:/](([^/]+)/[^.]+)(\.git)?$#'"$format"'#'
|
|
||||||
}
|
|
||||||
|
|
||||||
# __hub_heads
|
|
||||||
# List all local "branch", and remote "owner/repo:branch"
|
|
||||||
__hub_heads() {
|
|
||||||
local i remote repo branch dir=$(__gitdir)
|
|
||||||
if [ -d "$dir" ]; then
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/heads/"
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/remotes/${remote}/" | while read branch; do
|
|
||||||
echo "${repo}:${branch#${remote}/}"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# __hub_revlist [REMOTE]
|
|
||||||
# List all tags, and branches under REMOTE, without the "remote/" prefix
|
|
||||||
# REMOTE - Remote name to search branches from. Default is "origin"
|
|
||||||
__hub_revlist() {
|
|
||||||
local i remote=${1:-origin} dir=$(__gitdir)
|
|
||||||
if [ -d "$dir" ]; then
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/remotes/${remote}/" | while read i; do
|
|
||||||
echo "${i#${remote}/}"
|
|
||||||
done
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/tags/"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Enable completion for hub even when not using the alias
|
|
||||||
complete -o bashdefault -o default -o nospace -F _git gh 2>/dev/null \
|
|
||||||
|| complete -o default -o nospace -F _git gh
|
|
||||||
fi
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
cite "about-completion"
|
||||||
|
about-completion "GitHub CLI completion"
|
||||||
|
|
||||||
|
if _binary_exists gh; then
|
||||||
|
if _command_exists brew; then
|
||||||
|
_log_warning "You don't need github-cli completion enabled if you have system completion enabled"
|
||||||
|
fi
|
||||||
|
eval "$(gh completion --shell=bash)"
|
||||||
|
fi
|
||||||
|
|
@ -1,281 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# bash completion for go tool
|
# bash completion for go tool
|
||||||
# https://github.com/thomasf/go-bash-completion
|
# https://github.com/posener/complete
|
||||||
|
# https://pkg.go.dev/github.com/posener/complete?tab=doc
|
||||||
|
|
||||||
# install in /etc/bash_completion.d/ or your personal directory
|
# Install gocomplete:
|
||||||
|
# go get -u github.com/posener/complete/gocomplete
|
||||||
|
# gocomplete -install
|
||||||
|
|
||||||
complete -f -X '!*.8' 8l
|
if _command_exists gocomplete && _command_exists go ; then
|
||||||
complete -f -X '!*.6' 6l
|
complete -C "${GOBIN}"/gocomplete go
|
||||||
complete -f -X '!*.5' 5l
|
|
||||||
complete -f -X '!*.go' 8g 6g 5g gofmt gccgo
|
|
||||||
|
|
||||||
_go_clear_cache() {
|
|
||||||
unset _go_imports
|
|
||||||
}
|
|
||||||
_go_importpath_cache() {
|
|
||||||
if [ -z "$_go_imports" ]; then
|
|
||||||
_go_imports=$(go list all 2>/dev/null)
|
|
||||||
export _go_imports
|
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
_go_importpath()
|
|
||||||
{
|
|
||||||
echo "$(compgen -W "$_go_imports" -- "$1")"
|
|
||||||
}
|
|
||||||
|
|
||||||
_go()
|
|
||||||
{
|
|
||||||
# TODO: Only allow flags before other arguments. run already does
|
|
||||||
# this.
|
|
||||||
|
|
||||||
local cur=`_get_cword`
|
|
||||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
||||||
|
|
||||||
local cmd="${COMP_WORDS[1]}"
|
|
||||||
|
|
||||||
local cmds="build clean doc env fix fmt get
|
|
||||||
install list run test tool version vet"
|
|
||||||
local addhelp="gopath importpath remote
|
|
||||||
testflag testfunc"
|
|
||||||
local other="help"
|
|
||||||
local env_vars="GOARCH GOBIN GOEXE GOHOSTARCH GOHOSTOS GOOS GOPATH GORACE
|
|
||||||
GOROOT GOTOOLDIR GO15VENDOREXPERIMENT CC GOGCCFLAGS CXX CGO_ENABLED"
|
|
||||||
|
|
||||||
if [ "$COMP_CWORD" == 1 ]; then
|
|
||||||
for opt in $cmds; do
|
|
||||||
if [[ "$opt" == "$cmd" ]]; then
|
|
||||||
COMPREPLY=("$opt")
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$cmd" in
|
|
||||||
'build')
|
|
||||||
case "$prev" in
|
|
||||||
'-o')
|
|
||||||
_filedir
|
|
||||||
;;
|
|
||||||
'-p')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-a -n -o -p -v -x" -- "$cur"))
|
|
||||||
else
|
|
||||||
local found=0
|
|
||||||
for ((i=0; i < ${#COMP_WORDS[@]}; i++)); do
|
|
||||||
case "$i" in
|
|
||||||
0|1|"$COMP_CWORD")
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
local opt="${COMP_WORDS[i]}"
|
|
||||||
if [[ "$opt" != -* ]]; then
|
|
||||||
if [[ "$opt" == *.go && -f "$opt" ]]; then
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
else
|
|
||||||
found=2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
case "$found" in
|
|
||||||
0)
|
|
||||||
_filedir go
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY+=(`_go_importpath "$cur"`)
|
|
||||||
;;
|
|
||||||
1)
|
|
||||||
_filedir go
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
'clean')
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-i -r -n -x" -- "$cur"))
|
|
||||||
else
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
'doc')
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
;;
|
|
||||||
'env')
|
|
||||||
COMPREPLY=($(compgen -W "$env_vars" -- "$cur"))
|
|
||||||
;;
|
|
||||||
'fix')
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
;;
|
|
||||||
'fmt')
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
;;
|
|
||||||
'get')
|
|
||||||
case "$prev" in
|
|
||||||
'-p')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-a -d -fix -n -p -u -v -x" -- "$cur"))
|
|
||||||
else
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
'install')
|
|
||||||
case "$prev" in
|
|
||||||
'-p')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-a -n -p -v -x" -- "$cur"))
|
|
||||||
else
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
'list')
|
|
||||||
case "$prev" in
|
|
||||||
'-f')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-e -f -json" -- "$cur"))
|
|
||||||
else
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
'run')
|
|
||||||
if [[ "$cur" == -* && "$prev" != *.go ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-a -n -x" -- "$cur"))
|
|
||||||
else
|
|
||||||
_filedir
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
'test') # TODO: Support for testflags.
|
|
||||||
case "$prev" in
|
|
||||||
'-file')
|
|
||||||
_filedir go
|
|
||||||
;;
|
|
||||||
'-p')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "-c -file -i -p -x" -- "$cur"))
|
|
||||||
else
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
'tool')
|
|
||||||
if [ "$COMP_CWORD" == 2 ]; then
|
|
||||||
COMPREPLY=($(compgen -W "$(go tool)" -- "$cur"))
|
|
||||||
else
|
|
||||||
case "${COMP_WORDS[2]}" in
|
|
||||||
[568]a) # TODO: Implement something.
|
|
||||||
#_go_tool_568a
|
|
||||||
;;
|
|
||||||
[568]c) # TODO: Implement something.
|
|
||||||
#_go_tool_568c
|
|
||||||
;;
|
|
||||||
[568]g) # TODO: Implement something.
|
|
||||||
#_go_tool_568g
|
|
||||||
;;
|
|
||||||
[568]l) # TODO: Implement something.
|
|
||||||
#_go_tool_568l
|
|
||||||
;;
|
|
||||||
'api') # TODO: Implement something.
|
|
||||||
#_go_tool_api
|
|
||||||
;;
|
|
||||||
'cgo') # TODO: Implement something.
|
|
||||||
#_go_tool_cgo
|
|
||||||
;;
|
|
||||||
'cov') # TODO: Implement something.
|
|
||||||
#_go_tool_cov
|
|
||||||
;;
|
|
||||||
'dist') # TODO: Implement something.
|
|
||||||
#_go_tool_dist
|
|
||||||
;;
|
|
||||||
'ebnflint') # TODO: Implement something.
|
|
||||||
#_go_tool_ebnflint
|
|
||||||
;;
|
|
||||||
'fix') # TODO: Implement something.
|
|
||||||
#_go_tool_fix
|
|
||||||
;;
|
|
||||||
'gotype') # TODO: Implement something.
|
|
||||||
#_go_tool_gotype
|
|
||||||
;;
|
|
||||||
'nm') # TODO: Implement something.
|
|
||||||
#_go_tool_nm
|
|
||||||
;;
|
|
||||||
'pack') # TODO: Implement something.
|
|
||||||
#_go_tool_pack
|
|
||||||
;;
|
|
||||||
'pprof') # TODO: Implement something.
|
|
||||||
#_go_tool_pprof
|
|
||||||
;;
|
|
||||||
'prof') # TODO: Implement something.
|
|
||||||
#_go_tool_prof
|
|
||||||
;;
|
|
||||||
'vet') # TODO: Implement something.
|
|
||||||
#_go_tool_vet
|
|
||||||
;;
|
|
||||||
'yacc') # TODO: Implement something.
|
|
||||||
#_go_tool_yacc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
COMPREPLY=($(compgen -W "${COMPREPLY[*]} -h" -- "$cur"))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
'version')
|
|
||||||
;;
|
|
||||||
'vet')
|
|
||||||
if [[ "$cur" == -* ]]; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
_go_importpath_cache
|
|
||||||
COMPREPLY=(`_go_importpath "$cur"`)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
'help')
|
|
||||||
if [ "$COMP_CWORD" == 2 ]; then
|
|
||||||
COMPREPLY=($(compgen -W "$cmds $addhelp" -- "$cur"))
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ "$COMP_CWORD" == 1 ]; then
|
|
||||||
COMPREPLY=($(compgen -W "$cmds $other" -- "$cur"))
|
|
||||||
else
|
|
||||||
_filedir
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
complete $filenames -F _go go
|
|
||||||
|
|
||||||
# vim:ts=2 sw=2 et syn=sh
|
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,3 @@ _homesick_complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o bashdefault -o default -F _homesick_complete homesick
|
complete -o bashdefault -o default -F _homesick_complete homesick
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; t
|
||||||
_completion_loader git
|
_completion_loader git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that git tab completion is available
|
# Check that git tab completion is available and we haven't already set up completion
|
||||||
if declare -F _git > /dev/null; then
|
if declare -F _git > /dev/null && ! declare -F __git_list_all_commands_without_hub > /dev/null; then
|
||||||
# Duplicate and rename the 'list_all_commands' function
|
# Duplicate and rename the 'list_all_commands' function
|
||||||
eval "$(declare -f __git_list_all_commands | \
|
eval "$(declare -f __git_list_all_commands | \
|
||||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
||||||
|
|
@ -17,11 +17,16 @@ if declare -F _git > /dev/null; then
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
alias
|
alias
|
||||||
pull-request
|
pull-request
|
||||||
|
pr
|
||||||
|
issue
|
||||||
|
release
|
||||||
fork
|
fork
|
||||||
create
|
create
|
||||||
|
delete
|
||||||
browse
|
browse
|
||||||
compare
|
compare
|
||||||
ci-status
|
ci-status
|
||||||
|
sync
|
||||||
EOF
|
EOF
|
||||||
__git_list_all_commands_without_hub
|
__git_list_all_commands_without_hub
|
||||||
}
|
}
|
||||||
|
|
@ -213,21 +218,36 @@ EOF
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub fork [--no-remote]
|
# hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION]
|
||||||
_git_fork() {
|
_git_fork() {
|
||||||
local i c=2 remote=yes
|
local i c=2 flags="--no-remote --remote-name --org"
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt $cword ]; do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
|
--org)
|
||||||
|
((c++))
|
||||||
|
flags=${flags/$i/}
|
||||||
|
;;
|
||||||
|
--remote-name)
|
||||||
|
((c++))
|
||||||
|
flags=${flags/$i/}
|
||||||
|
flags=${flags/--no-remote/}
|
||||||
|
;;
|
||||||
--no-remote)
|
--no-remote)
|
||||||
unset remote
|
flags=${flags/$i/}
|
||||||
|
flags=${flags/--remote-name/}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
((c++))
|
((c++))
|
||||||
done
|
done
|
||||||
if [ -n "$remote" ]; then
|
case "$prev" in
|
||||||
__gitcomp "--no-remote"
|
--remote-name|--org)
|
||||||
fi
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
__gitcomp "$flags"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
|
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,3 @@ _complete_invoke() {
|
||||||
# * -o default: when function generates no results, use filenames.
|
# * -o default: when function generates no results, use filenames.
|
||||||
# * positional args: program names to complete for.
|
# * positional args: program names to complete for.
|
||||||
complete -F _complete_invoke -o default invoke inv
|
complete -F _complete_invoke -o default invoke inv
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if _command_exists kind; then
|
||||||
|
eval "$(kind completion bash)"
|
||||||
|
fi
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Published originally as public domain code at https://github.com/wk8/knife-bash-autocomplete
|
||||||
|
|
||||||
##############
|
##############
|
||||||
### CONFIG ###
|
### CONFIG ###
|
||||||
##############
|
##############
|
||||||
|
|
@ -19,7 +21,7 @@ _KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE=86400
|
||||||
### init
|
### init
|
||||||
_KAC_CACHE_TMP_DIR="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/tmp"
|
_KAC_CACHE_TMP_DIR="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/tmp"
|
||||||
# make sure the cache dir exists
|
# make sure the cache dir exists
|
||||||
mkdir -p $_KAC_CACHE_TMP_DIR
|
mkdir -p "$_KAC_CACHE_TMP_DIR"
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
### Cache helper functions ###
|
### Cache helper functions ###
|
||||||
|
|
@ -31,134 +33,127 @@ stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_
|
||||||
# returns 0 iff the file whose path is given as 1st argument
|
# returns 0 iff the file whose path is given as 1st argument
|
||||||
# exists and has last been modified in the last $2 seconds
|
# exists and has last been modified in the last $2 seconds
|
||||||
# returns 1 otherwise
|
# returns 1 otherwise
|
||||||
_KAC_is_file_newer_than()
|
_KAC_is_file_newer_than() {
|
||||||
{
|
|
||||||
[ -f "$1" ] || return 1
|
[ -f "$1" ] || return 1
|
||||||
[ $(( $(date +%s) - $($_KAC_STAT_COMMAND "$1") )) -gt $2 ] && return 1 || return 0
|
[ $(($(date +%s) - $($_KAC_STAT_COMMAND "$1"))) -gt "$2" ] && return 1 || return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# helper function for _KAC_get_and_regen_cache, see doc below
|
# helper function for _KAC_get_and_regen_cache, see doc below
|
||||||
_KAC_regen_cache()
|
_KAC_regen_cache() {
|
||||||
{
|
|
||||||
local CACHE_NAME=$1
|
local CACHE_NAME=$1
|
||||||
local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
||||||
local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX")
|
local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX")
|
||||||
shift 1
|
shift 1
|
||||||
"$@" > $TMP_FILE 2> /dev/null
|
|
||||||
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
|
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
|
||||||
[[ $? != 0 ]] && [[ $(cat $TMP_FILE | wc -l) == 0 ]] && rm -f $TMP_FILE && touch $CACHE_PATH && return 1 \
|
if ! "$@" > "$TMP_FILE" 2> /dev/null; then
|
||||||
|| mv -f $TMP_FILE $CACHE_PATH
|
[[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1
|
||||||
|
else
|
||||||
|
mv -f "$TMP_FILE" "$CACHE_PATH"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# cached files can't have spaces in their names
|
# cached files can't have spaces in their names
|
||||||
_KAC_get_cache_name_from_command()
|
_KAC_get_cache_name_from_command() {
|
||||||
{
|
echo "${@/ /_SPACE_}"
|
||||||
echo "$@" | sed 's/ /_SPACE_/g'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# the reverse operation from the function above
|
# the reverse operation from the function above
|
||||||
_KAC_get_command_from_cache_name()
|
_KAC_get_command_from_cache_name() {
|
||||||
{
|
echo "${@/_SPACE_/ }"
|
||||||
echo "$@" | sed 's/_SPACE_/ /g'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# given a command as argument, it fetches the cache for that command if it can find it
|
# given a command as argument, it fetches the cache for that command if it can find it
|
||||||
# otherwise it waits for the cache to be generated
|
# otherwise it waits for the cache to be generated
|
||||||
# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable
|
# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable
|
||||||
# for obvious reason, do NOT call that in a sub-shell (in particular, no piping)
|
# for obvious reason, do NOT call that in a sub-shell (in particular, no piping)
|
||||||
_KAC_get_and_regen_cache()
|
_KAC_get_and_regen_cache() {
|
||||||
{
|
|
||||||
# the cache name can't have space in it
|
# the cache name can't have space in it
|
||||||
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
|
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
|
||||||
local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $@"
|
local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $*"
|
||||||
_KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
_KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
||||||
# no need to wait for the regen if the file already exists
|
# no need to wait for the regen if the file already exists
|
||||||
[ -f $_KAC_CACHE_PATH ] && ($REGEN_CMD &) || $REGEN_CMD
|
if [[ -f "$_KAC_CACHE_PATH" ]]; then
|
||||||
|
($REGEN_CMD &)
|
||||||
|
else
|
||||||
|
$REGEN_CMD
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# performs two things: first, deletes all obsolete temp files
|
# performs two things: first, deletes all obsolete temp files
|
||||||
# then refreshes stale caches that haven't been called in a long time
|
# then refreshes stale caches that haven't been called in a long time
|
||||||
_KAC_clean_cache()
|
_KAC_clean_cache() {
|
||||||
{
|
|
||||||
local FILE CMD
|
local FILE CMD
|
||||||
# delete all obsolete temp files, could be lingering there for any kind of crash in the caching process
|
# delete all obsolete temp files, could be lingering there for any kind of crash in the caching process
|
||||||
for FILE in $(ls $_KAC_CACHE_TMP_DIR)
|
for FILE in "$_KAC_CACHE_TMP_DIR"/*; do
|
||||||
do
|
_KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" || rm -f "$FILE"
|
||||||
_KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE || rm -f $FILE
|
|
||||||
done
|
done
|
||||||
# refresh really stale caches
|
# refresh really stale caches
|
||||||
for FILE in $(find $_KNIFE_AUTOCOMPLETE_CACHE_DIR -maxdepth 1 -type f -not -name '.*')
|
find "$_KNIFE_AUTOCOMPLETE_CACHE_DIR" -maxdepth 1 -type f -not -name '.*' \
|
||||||
do
|
| while read -r FILE; do
|
||||||
_KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE && continue
|
_KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" && continue
|
||||||
# first let's get the original command
|
# first let's get the original command
|
||||||
CMD=$(_KAC_get_command_from_cache_name $(basename "$FILE"))
|
CMD=$(_KAC_get_command_from_cache_name "$(basename "$FILE")")
|
||||||
# then regen the cache
|
# then regen the cache
|
||||||
_KAC_get_and_regen_cache "$CMD" > /dev/null
|
_KAC_get_and_regen_cache "$CMD" > /dev/null
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# perform a cache cleaning when loading this file
|
# perform a cache cleaning when loading this file
|
||||||
_KAC_clean_cache
|
# On big systems this could baloon up to a 30 second run or more, so not enabling by default.
|
||||||
|
[[ "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
### End of cache helper functions ###
|
### End of cache helper functions ###
|
||||||
#####################################
|
#####################################
|
||||||
|
|
||||||
|
|
||||||
# returns all the possible knife sub-commands
|
# returns all the possible knife sub-commands
|
||||||
_KAC_knife_commands()
|
_KAC_knife_commands() {
|
||||||
{
|
|
||||||
knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g'
|
knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND
|
# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND
|
||||||
# additionnally, returns 1 iff the current base command is not complete, 0 otherwise
|
# additionnally, returns 1 iff the current base command is not complete, 0 otherwise
|
||||||
# also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete
|
# also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete
|
||||||
_KAC_get_current_base_command()
|
_KAC_get_current_base_command() {
|
||||||
{
|
|
||||||
local PREVIOUS="knife"
|
local PREVIOUS="knife"
|
||||||
local I=1
|
local I=1
|
||||||
local CURRENT
|
local CURRENT
|
||||||
while [ $I -le $COMP_CWORD ]
|
while [ $I -le "$COMP_CWORD" ]; do
|
||||||
do
|
|
||||||
# command words are all lower-case
|
# command words are all lower-case
|
||||||
echo ${COMP_WORDS[$I]} | grep -E "^[a-z]+$" > /dev/null || break
|
echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break
|
||||||
CURRENT="$PREVIOUS ${COMP_WORDS[$I]}"
|
CURRENT="$PREVIOUS ${COMP_WORDS[$I]}"
|
||||||
cat $_KAC_CACHE_PATH | grep -E "^$CURRENT" > /dev/null || break
|
grep -E "^$CURRENT" "$_KAC_CACHE_PATH" > /dev/null || break
|
||||||
PREVIOUS=$CURRENT
|
PREVIOUS=$CURRENT
|
||||||
I=$(( $I + 1))
|
I=$((I + 1))
|
||||||
done
|
done
|
||||||
_KAC_CURRENT_COMMAND=$PREVIOUS
|
_KAC_CURRENT_COMMAND=$PREVIOUS
|
||||||
[ $I -le $COMP_CWORD ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I
|
[ $I -le "$COMP_CWORD" ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I
|
||||||
}
|
}
|
||||||
|
|
||||||
# searches the position of the currently completed argument in the current base command
|
# searches the position of the currently completed argument in the current base command
|
||||||
# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...)
|
# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...)
|
||||||
# assumes the current base command is complete
|
# assumes the current base command is complete
|
||||||
_KAC_get_current_arg_position()
|
_KAC_get_current_arg_position() {
|
||||||
{
|
local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1))
|
||||||
local CURRENT_ARG_POS=$(( $_KAC_CURRENT_COMMAND_NB_WORDS + 1 ))
|
local COMPLETE_COMMAND=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH")
|
||||||
local COMPLETE_COMMAND=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND")
|
|
||||||
local CURRENT_ARG
|
local CURRENT_ARG
|
||||||
while [ $CURRENT_ARG_POS -le $COMP_CWORD ]
|
while [ "$CURRENT_ARG_POS" -le "$COMP_CWORD" ]; do
|
||||||
do
|
CURRENT_ARG=$(echo "$COMPLETE_COMMAND" | cut -d ' ' -f "$CURRENT_ARG_POS")
|
||||||
CURRENT_ARG=$(echo $COMPLETE_COMMAND | cut -d ' ' -f $CURRENT_ARG_POS)
|
|
||||||
# we break if the current arg is a "plural" arg
|
# we break if the current arg is a "plural" arg
|
||||||
echo $CURRENT_ARG | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break
|
echo "$CURRENT_ARG" | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break
|
||||||
CURRENT_ARG_POS=$(( $CURRENT_ARG_POS + 1 ))
|
CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1))
|
||||||
done
|
done
|
||||||
echo $CURRENT_ARG_POS
|
echo "$CURRENT_ARG_POS"
|
||||||
}
|
}
|
||||||
|
|
||||||
# the actual auto-complete function
|
# the actual auto-complete function
|
||||||
_knife()
|
_knife() {
|
||||||
{
|
|
||||||
_KAC_get_and_regen_cache _KAC_knife_commands
|
_KAC_get_and_regen_cache _KAC_knife_commands
|
||||||
local RAW_LIST ITEM REGEN_CMD ARG_POSITION
|
local RAW_LIST ITEM REGEN_CMD ARG_POSITION
|
||||||
COMREPLY=()
|
COMREPLY=()
|
||||||
# get correct command & arg pos
|
# get correct command & arg pos
|
||||||
_KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$(( $COMP_CWORD + 1 ))
|
_KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$((COMP_CWORD + 1))
|
||||||
RAW_LIST=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND" | cut -d ' ' -f $ARG_POSITION | uniq)
|
RAW_LIST=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH" | cut -d ' ' -f $ARG_POSITION | uniq)
|
||||||
|
|
||||||
# we need to process that raw list a bit, most notably for placeholders
|
# we need to process that raw list a bit, most notably for placeholders
|
||||||
# NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc)
|
# NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc)
|
||||||
|
|
@ -166,16 +161,15 @@ _knife()
|
||||||
# current base command - that might limit my script in some situation, but that way I'm sure it caches only
|
# current base command - that might limit my script in some situation, but that way I'm sure it caches only
|
||||||
# not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin)
|
# not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin)
|
||||||
LIST=""
|
LIST=""
|
||||||
for ITEM in $RAW_LIST
|
for ITEM in $RAW_LIST; do
|
||||||
do
|
|
||||||
# always relevant if only lower-case chars : continuation of the base command
|
# always relevant if only lower-case chars : continuation of the base command
|
||||||
echo $ITEM | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue
|
echo "$ITEM" | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue
|
||||||
case $ITEM in
|
case "$ITEM" in
|
||||||
*COOKBOOK*)
|
*COOKBOOK*)
|
||||||
# special case for cookbooks : from site or local
|
# special case for cookbooks : from site or local
|
||||||
[[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list"
|
[[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list"
|
||||||
_KAC_get_and_regen_cache $REGEN_CMD
|
_KAC_get_and_regen_cache "$REGEN_CMD"
|
||||||
LIST="$LIST $(cat $_KAC_CACHE_PATH | cut -d ' ' -f 1)"
|
LIST="$LIST $(cut -d ' ' -f 1 < "$_KAC_CACHE_PATH")"
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
*ITEM*)
|
*ITEM*)
|
||||||
|
|
@ -197,11 +191,11 @@ _knife()
|
||||||
# not a generic argument we support...
|
# not a generic argument we support...
|
||||||
*) continue ;;
|
*) continue ;;
|
||||||
esac
|
esac
|
||||||
_KAC_get_and_regen_cache $REGEN_CMD
|
_KAC_get_and_regen_cache "$REGEN_CMD"
|
||||||
LIST="$LIST $(cat $_KAC_CACHE_PATH)"
|
LIST="$LIST $(cat "$_KAC_CACHE_PATH")"
|
||||||
done
|
done
|
||||||
|
# shellcheck disable=SC2207,SC2086
|
||||||
COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]}))
|
COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]}))
|
||||||
}
|
}
|
||||||
|
|
||||||
#complete -f -F _knife knife
|
|
||||||
complete -F _knife knife
|
complete -F _knife knife
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
if command -v laravel > /dev/null; then
|
||||||
|
__laravel_completion() {
|
||||||
|
local OPTS=("-h --help -q --quiet --ansi --no-ansi -n --no-interaction -v -vv -vvv --verbose help list new")
|
||||||
|
COMPREPLY=()
|
||||||
|
for _opt_ in ${OPTS[@]}; do
|
||||||
|
if [[ "$_opt_" == "$2"* ]]; then
|
||||||
|
COMPREPLY+=("$_opt_")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F __laravel_completion laravel
|
||||||
|
fi
|
||||||
|
|
@ -1,3 +1,34 @@
|
||||||
# Add completion for Makefile
|
# Bash completion for Makefile
|
||||||
# see http://stackoverflow.com/a/38415982/1472048
|
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048
|
||||||
complete -W "\`grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_-]*$//'\`" make
|
|
||||||
|
_makecomplete() {
|
||||||
|
COMPREPLY=()
|
||||||
|
|
||||||
|
# https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html
|
||||||
|
local files=()
|
||||||
|
for f in 'GNUmakefile' 'makefile' 'Makefile' ; do
|
||||||
|
[ -f "$f" ] && files+=("$f")
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "${#files[@]}" -eq 0 ] && return 0
|
||||||
|
|
||||||
|
# collect all targets
|
||||||
|
local targets=()
|
||||||
|
for f in "${files[@]}" ; do
|
||||||
|
while IFS='' read -r line ; do
|
||||||
|
targets+=("$line")
|
||||||
|
done < <(grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "${#targets[@]}" -eq 0 ] && return 0
|
||||||
|
|
||||||
|
# use the targets for completion
|
||||||
|
while IFS='' read -r line ; do
|
||||||
|
COMPREPLY+=("$line")
|
||||||
|
done < <(compgen -W "$(tr ' ' '\n' <<<"${targets[@]}" | sort -u)" -- "${COMP_WORDS[COMP_CWORD]}")
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -o nospace -F _makecomplete make
|
||||||
|
complete -o nospace -F _makecomplete gnumake
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
_command_exists minishift && source <(minishift completion bash)
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
if _command_exists ng; then
|
||||||
|
# No longer supported, please see https://github.com/angular/angular-cli/issues/11043
|
||||||
|
# Fix courtesy of https://stackoverflow.com/questions/50194674/ng-completion-no-longer-exists
|
||||||
|
# . <(ng completion --bash)
|
||||||
|
|
||||||
. <(ng completion --bash)
|
NG_COMMANDS="add build config doc e2e generate help lint new run serve test update version xi18n"
|
||||||
|
complete -W "$NG_COMMANDS" ng
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
#!/usr/bin/env bash
|
_command_exists oc && source <(oc completion bash)
|
||||||
|
|
||||||
[ -x "$(which oc)" ] && eval "$(oc completion bash)"
|
|
||||||
|
|
|
||||||
|
|
@ -161,4 +161,3 @@ _packer_completion ()
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o nospace -F _packer_completion packer
|
complete -o nospace -F _packer_completion packer
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
# https://pip.pypa.io/en/stable/user_guide/#command-completion
|
||||||
# pip bash completion start
|
# Of course, you should first install the pip, say on Debian:
|
||||||
_pip_completion()
|
# sudo apt-get install python-pip
|
||||||
{
|
# sudo apt-get install python3-pip
|
||||||
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
|
# If the pip package is installed within virtual environments, say, python managed by pyenv,
|
||||||
COMP_CWORD=$COMP_CWORD \
|
# you should first initilization the corresponding environment.
|
||||||
PIP_AUTO_COMPLETE=1 $1 ) )
|
# So that the pip/pip3 is in system's path.
|
||||||
}
|
if command -v pip >/dev/null; then
|
||||||
complete -o default -F _pip_completion pip
|
eval "$(pip completion --bash)"
|
||||||
# pip bash completion end
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
# https://pip.pypa.io/en/stable/user_guide/#command-completion
|
||||||
# pip bash completion start
|
# Of course, you should first install the pip, say on Debian:
|
||||||
_pip_completion()
|
# sudo apt-get install python-pip
|
||||||
{
|
# sudo apt-get install python3-pip
|
||||||
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
|
# If the pip package is installed within virtual environments, say, python managed by pyenv,
|
||||||
COMP_CWORD=$COMP_CWORD \
|
# you should first initilization the corresponding environment.
|
||||||
PIP_AUTO_COMPLETE=1 $1 ) )
|
# So that the pip/pip3 is in system's path.
|
||||||
}
|
if command -v pip3 >/dev/null; then
|
||||||
complete -o default -F _pip_completion pip3
|
eval "$(pip3 completion --bash)"
|
||||||
# pip bash completion end
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# pipx completion
|
||||||
|
|
||||||
|
if _command_exists register-python-argcomplete && _command_exists pipx; then
|
||||||
|
eval "$(register-python-argcomplete pipx)"
|
||||||
|
fi
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
|
# Ensure that we log to doctor so the user can address these issues
|
||||||
|
_is_function _init_completion ||
|
||||||
|
_log_error '_init_completion not found. Ensure bash-completion 2.0 or newer is installed and configured properly.'
|
||||||
|
_is_function _rl_enabled ||
|
||||||
|
_log_error '_rl_enabled not found. Ensure bash-completion 2.0 or newer is installed and configured properly.'
|
||||||
|
|
||||||
_pj() {
|
_pj() {
|
||||||
[ -z "$PROJECT_PATHS" ] && return
|
_is_function _init_completion || return
|
||||||
|
_is_function _rl_enabled || return
|
||||||
|
[ -n "$PROJECT_PATHS" ] || return
|
||||||
shift
|
shift
|
||||||
[ "$1" == "open" ] && shift
|
[ "$1" == "open" ] && shift
|
||||||
|
|
||||||
|
|
@ -36,4 +44,3 @@ _pj() {
|
||||||
|
|
||||||
complete -F _pj -o nospace pj
|
complete -F _pj -o nospace pj
|
||||||
complete -F _pj -o nospace pjo
|
complete -F _pj -o nospace pjo
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# rustup (Rust toolchain installer) completion
|
||||||
|
|
||||||
|
if _binary_exists rustup; then
|
||||||
|
eval "$(rustup completions bash)"
|
||||||
|
fi
|
||||||
|
|
@ -326,4 +326,3 @@ _saltcp(){
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _saltcp salt-cp
|
complete -F _saltcp salt-cp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,167 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------+
|
||||||
|
# |
|
||||||
|
# Thanks to Alexander Korznikov |
|
||||||
|
# http://www.korznikov.com/2014/12/bash-tab-completion-for-awesome-tool.html |
|
||||||
|
# |
|
||||||
|
# ---------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
if command -v sqlmap > /dev/null; then
|
||||||
|
|
||||||
|
_sqlmap()
|
||||||
|
{
|
||||||
|
local cur prev
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=$(_get_cword)
|
||||||
|
prev=$(_get_pword)
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
|
||||||
|
# List directory content
|
||||||
|
--tamper)
|
||||||
|
COMPREPLY=( $( compgen -W "$tamper" -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--output-dir|-t|-l|-m|-r|--load-cookies|--proxy-file|--sql-file|--shared-lib|--file-write)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-c)
|
||||||
|
_filedir ini
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--method)
|
||||||
|
COMPREPLY=( $( compgen -W 'GET POST PUT' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--auth-type)
|
||||||
|
COMPREPLY=( $( compgen -W 'Basic Digest NTLM PKI' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--tor-type)
|
||||||
|
COMPREPLY=( $( compgen -W 'HTTP SOCKS4 SOCKS5' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-v)
|
||||||
|
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--dbms)
|
||||||
|
COMPREPLY=( $( compgen -W 'mysql mssql access postgres' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--level|--crawl)
|
||||||
|
COMPREPLY=( $( compgen -W '1 2 3 4 5' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--risk)
|
||||||
|
COMPREPLY=( $( compgen -W '0 1 2 3' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--technique)
|
||||||
|
COMPREPLY=( $( compgen -W 'B E U S T Q' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-s)
|
||||||
|
_filedir sqlite
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--dump-format)
|
||||||
|
COMPREPLY=( $( compgen -W 'CSV HTML SQLITE' -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-x)
|
||||||
|
_filedir xml
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$cur" == * ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \
|
||||||
|
--data --param-del --cookie --cookie-del --load-cookies \
|
||||||
|
--drop-set-cookie --user-agent --random-agent --host --referer \
|
||||||
|
--headers --auth-type --auth-cred --auth-private --ignore-401 \
|
||||||
|
--proxy --proxy-cred --proxy-file --ignore-proxy --tor --tor-port \
|
||||||
|
--tor-type --check-tor --delay --timeout --retries --randomize \
|
||||||
|
--safe-url --safe-freq --skip-urlencode --csrf-token --csrf-url \
|
||||||
|
--force-ssl --hpp --eval -o --predict-output --keep-alive \
|
||||||
|
--null-connection --threads -p --skip --dbms --dbms-cred \
|
||||||
|
--os --invalid-bignum --invalid-logical --invalid-string \
|
||||||
|
--no-cast --no-escape --prefix --suffix --tamper --level \
|
||||||
|
--risk --string --not-string --regexp --code --text-only \
|
||||||
|
--titles --technique --time-sec --union-cols --union-char \
|
||||||
|
--union-from --dns-domain --second-order -f --fingerprint \
|
||||||
|
-a --all -b --banner --current-user --current-db --hostname \
|
||||||
|
--is-dba --users --passwords --privileges --roles --dbs --tables \
|
||||||
|
--columns --schema --count --dump --dump-all --search --comments \
|
||||||
|
-D -T -C -X -U --exclude-sysdbs --where --start --stop \
|
||||||
|
--first --last --sql-query --sql-shell --sql-file --common-tables \
|
||||||
|
--common-columns --udf-inject --shared-lib --file-read --file-write \
|
||||||
|
--file-dest --os-cmd --os-shell --os-pwn --os-smbrelay --os-bof \
|
||||||
|
--priv-esc --msf-path --tmp-path --reg-read --reg-add --reg-del \
|
||||||
|
--reg-key --reg-value --reg-data --reg-type -s -t --batch \
|
||||||
|
--charset --crawl --csv-del --dump-format --eta --flush-session \
|
||||||
|
--forms --fresh-queries --hex --output-dir --parse-errors \
|
||||||
|
--pivot-column --save --scope --test-filter --update \
|
||||||
|
-z --alert --answers --beep --check-waf --cleanup \
|
||||||
|
--dependencies --disable-coloring --gpage --identify-waf \
|
||||||
|
--mobile --page-rank --purge-output --smart \
|
||||||
|
--sqlmap-shell --wizard' -- "$cur" ) )
|
||||||
|
# this removes any options from the list of completions that have
|
||||||
|
# already been specified somewhere on the command line, as long as
|
||||||
|
# these options can only be used once (in a word, "options", in
|
||||||
|
# opposition to "tests" and "actions", as in the find(1) manpage).
|
||||||
|
onlyonce=' -h --help -hh --version -v -d -u --url -l -x -m -r -g -c \
|
||||||
|
--drop-set-cookie --random-agent \
|
||||||
|
--ignore-401 \
|
||||||
|
--ignore-proxy --tor \
|
||||||
|
--check-tor \
|
||||||
|
--skip-urlencode \
|
||||||
|
--force-ssl --hpp -o --predict-output --keep-alive \
|
||||||
|
--null-connection -p \
|
||||||
|
--invalid-bignum --invalid-logical --invalid-string \
|
||||||
|
--no-cast --no-escape \
|
||||||
|
--text-only \
|
||||||
|
--titles \
|
||||||
|
-f --fingerprint \
|
||||||
|
-a --all -b --banner --current-user --current-db --hostname \
|
||||||
|
--is-dba --users --passwords --privileges --roles --dbs --tables \
|
||||||
|
--columns --schema --count --dump --dump-all --search --comments \
|
||||||
|
-D -T -C -X -U --exclude-sysdbs \
|
||||||
|
--sql-shell --common-tables \
|
||||||
|
--common-columns --udf-inject \
|
||||||
|
--os-shell --os-pwn --os-smbrelay --os-bof \
|
||||||
|
--priv-esc --reg-read --reg-add --reg-del \
|
||||||
|
-s -t --batch \
|
||||||
|
--eta --flush-session \
|
||||||
|
--forms --fresh-queries --hex --parse-errors \
|
||||||
|
--save --update \
|
||||||
|
-z --beep --check-waf --cleanup \
|
||||||
|
--dependencies --disable-coloring --identify-waf \
|
||||||
|
--mobile --page-rank --purge-output --smart \
|
||||||
|
--sqlmap-shell --wizard '
|
||||||
|
COMPREPLY=( $( \
|
||||||
|
(while read -d ' ' i; do
|
||||||
|
[[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] &&
|
||||||
|
continue
|
||||||
|
# flatten array with spaces on either side,
|
||||||
|
# otherwise we cannot grep on word boundaries of
|
||||||
|
# first and last word
|
||||||
|
COMPREPLY=" ${COMPREPLY[@]} "
|
||||||
|
# remove word from list of completions
|
||||||
|
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
|
||||||
|
done
|
||||||
|
printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
|
||||||
|
) )
|
||||||
|
|
||||||
|
# else
|
||||||
|
# _filedir bat
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
complete -F _sqlmap sqlmap
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
@ -15,7 +15,7 @@ _sshcomplete() {
|
||||||
for fl in "$HOME/.ssh/config" \
|
for fl in "$HOME/.ssh/config" \
|
||||||
$(grep "^\s*Include" "$HOME/.ssh/config" |
|
$(grep "^\s*Include" "$HOME/.ssh/config" |
|
||||||
awk '{for (i=2; i<=NF; i++) print $i}' |
|
awk '{for (i=2; i<=NF; i++) print $i}' |
|
||||||
sed "s|^~/|$HOME/|")
|
sed -Ee "s|^([^/~])|$HOME/.ssh/\1|" -e "s|^~/|$HOME/|")
|
||||||
do
|
do
|
||||||
if [ -r "$fl" ]; then
|
if [ -r "$fl" ]; then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||||
|
|
@ -37,4 +37,4 @@ _sshcomplete() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o default -o nospace -F _sshcomplete ssh scp
|
complete -o default -o nospace -F _sshcomplete ssh scp slogin sftp
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,25 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Loads the system's Bash completion modules.
|
# Loads the system's Bash completion modules.
|
||||||
# If Homebrew is installed (OS X), its Bash completion modules are loaded.
|
# If Homebrew is installed (OS X), it's Bash completion modules are loaded.
|
||||||
|
|
||||||
if [ -f /etc/bash_completion ]; then
|
if [[ -r /etc/bash_completion ]] ; then
|
||||||
. /etc/bash_completion
|
# shellcheck disable=SC1091
|
||||||
fi
|
source /etc/bash_completion
|
||||||
|
|
||||||
# Some distribution makes use of a profile.d script to import completion.
|
# Some distribution makes use of a profile.d script to import completion.
|
||||||
if [ -f /etc/profile.d/bash_completion.sh ]; then
|
elif [[ -r /etc/profile.d/bash_completion.sh ]] ; then
|
||||||
. /etc/profile.d/bash_completion.sh
|
# shellcheck disable=SC1091
|
||||||
|
source /etc/profile.d/bash_completion.sh
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == 'Darwin' ]] && _command_exists brew ; then
|
||||||
if [ $(uname) = "Darwin" ] && command -v brew &>/dev/null ; then
|
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}
|
||||||
BREW_PREFIX=$(brew --prefix)
|
|
||||||
|
|
||||||
if [ -f "$BREW_PREFIX"/etc/bash_completion ]; then
|
|
||||||
. "$BREW_PREFIX"/etc/bash_completion
|
|
||||||
fi
|
|
||||||
|
|
||||||
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
||||||
if [ "${BASH_VERSINFO}" -ge 4 ] && [ -f "$BREW_PREFIX"/share/bash-completion/bash_completion ]; then
|
if [[ -r "$BREW_PREFIX"/etc/profile.d/bash_completion.sh ]] ; then
|
||||||
export BASH_COMPLETION_COMPAT_DIR="$BREW_PREFIX"/etc/bash_completion.d
|
# shellcheck disable=SC1090
|
||||||
. "$BREW_PREFIX"/share/bash-completion/bash_completion
|
source "$BREW_PREFIX"/etc/profile.d/bash_completion.sh
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,65 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
|
||||||
# Bash completion for the terraform command
|
|
||||||
#
|
|
||||||
# Copyright (C) 2018 Vangelis Tasoulas
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; either version 2
|
|
||||||
# of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
_terraform()
|
# Make sure terraform is installed
|
||||||
{
|
_command_exists terraform || return
|
||||||
local cur prev words cword opts
|
|
||||||
_get_comp_words_by_ref -n : cur prev words cword
|
|
||||||
COMPREPLY=()
|
|
||||||
opts=""
|
|
||||||
|
|
||||||
if [[ ${cword} -eq 1 ]] ; then
|
# Don't handle completion if it's already managed
|
||||||
|
complete -p terraform &>/dev/null && return
|
||||||
|
|
||||||
# Options that do not start with a hyphen, are always starting with four spaces.
|
# Terraform completes itself
|
||||||
opts="$(terraform --help | grep -E '^\s\s\s\s\S' | awk '{print $1}')"
|
complete -C terraform terraform
|
||||||
opts="${opts} --help --version"
|
|
||||||
|
|
||||||
elif [[ ${cword} -gt 1 ]] ; then
|
|
||||||
|
|
||||||
if [[ ${cword} -eq 2 && ${prev} == '--help' ]] ; then
|
|
||||||
|
|
||||||
opts="$(terraform --help | grep -E '^\s\s\s\s\S' | awk '{print $1}')"
|
|
||||||
|
|
||||||
elif [[ ${words[1]} != "--help" && ${words[1]} != "--version" && ${words[1]} != "version" ]] ; then
|
|
||||||
|
|
||||||
# Some commands accept hyphened parameters, ...
|
|
||||||
opts="$(terraform --help "${words[1]}" | grep -E '^\s+-' | awk '{print $1}' | awk -F '=' '{ if ($0 ~ /=/) {print $1"="} else {print $1} }')"
|
|
||||||
# but some other commands accept non-hyphened parameters.
|
|
||||||
opts="${opts} $(terraform --help "${words[1]}" | grep -E '^\s\s\s\s\S' | awk '{print $1}')"
|
|
||||||
# All of the commands accept the --help parameter which is not listed
|
|
||||||
# by the 'terraform --help <command>
|
|
||||||
opts="${opts} --help"
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
||||||
|
|
||||||
if [[ ${#COMPREPLY[*]} -eq 1 ]] ; then
|
|
||||||
if [[ ${COMPREPLY[0]} == *= ]] ; then
|
|
||||||
# When only one completion is left, check if there is an equal sign.
|
|
||||||
# If an equal sign, then add no space after the autocompleted word.
|
|
||||||
compopt -o nospace
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F _terraform terraform
|
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,3 @@ __kitchen_options () {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
complete -F __kitchen_options kitchen
|
complete -F __kitchen_options kitchen
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,4 +185,3 @@ _tmux() {
|
||||||
complete -F _tmux tmux
|
complete -F _tmux tmux
|
||||||
|
|
||||||
# END tmux completion
|
# END tmux completion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ __vagrantinvestigate() {
|
||||||
_vagrant() {
|
_vagrant() {
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
commands="snapshot box connect destroy docker-logs docker-run global-status halt help init list-commands login package plugin provision rdp reload resume rsync rsync-auto share ssh ssh-config status suspend up version"
|
commands="box cloud destroy global-status halt help hostmanager init login package plugin port powershell provision push rdp reload resume scp snapshot ssh ssh-config status suspend up upload validate vbguest version winrm winrm-config"
|
||||||
|
|
||||||
if [ $COMP_CWORD == 1 ]
|
if [ $COMP_CWORD == 1 ]
|
||||||
then
|
then
|
||||||
|
|
@ -91,12 +91,12 @@ _vagrant() {
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
"box")
|
"box")
|
||||||
box_commands="add help list remove repackage"
|
box_commands="add list outdated prune remove repackage update"
|
||||||
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
"plugin")
|
"plugin")
|
||||||
plugin_commands="install license list uninstall update"
|
plugin_commands="expunge install license list repair uninstall update"
|
||||||
COMPREPLY=($(compgen -W "${plugin_commands}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${plugin_commands}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
@ -105,7 +105,7 @@ _vagrant() {
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
"snapshot")
|
"snapshot")
|
||||||
snapshot_commands="back delete go list take"
|
snapshot_commands="delete list pop push restore save"
|
||||||
COMPREPLY=($(compgen -W "${snapshot_commands}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${snapshot_commands}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
@ -135,13 +135,29 @@ _vagrant() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"snapshot")
|
"snapshot")
|
||||||
if [ "$prev" == "go" ]; then
|
if [ "$prev" == "restore" ]; then
|
||||||
local snapshot_list=$(vagrant snapshot list | awk '/Name:/ { print $2 }')
|
COMPREPLY=($(compgen -W "${vm_list}" -- ${cur}))
|
||||||
COMPREPLY=($(compgen -W "${snapshot_list}" -- ${cur}))
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $COMP_CWORD == 4 ]
|
||||||
|
then
|
||||||
|
action="${COMP_WORDS[COMP_CWORD-3]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
|
case "$action" in
|
||||||
|
"snapshot")
|
||||||
|
if [ "$prev" == "restore" ]; then
|
||||||
|
local snapshot_list="$(vagrant snapshot list ${cur} 2>/dev/null | awk '{ORS=" "} /==>/ {next} {print}')"
|
||||||
|
COMPREPLY=($(compgen -W "${snapshot_list}" -- ${cur}))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
complete -F _vagrant vagrant
|
complete -F _vagrant vagrant
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,3 @@ if command -v wpscan > /dev/null; then
|
||||||
|
|
||||||
complete -F __wpscan_completion wpscan
|
complete -F __wpscan_completion wpscan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Bash-it
|
||||||
|

|
||||||
|

|
||||||
|
[](https://webchat.freenode.net/?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](https://bash-it.readthedocs.io/en/latest/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)
|
||||||
|
|
||||||
|
## 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][contribute]
|
||||||
|
|
||||||
|
[contribute]: https://github.com/Bash-it/bash-it/contributors
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
.. _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
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
.. _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.
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
# 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'
|
||||||
|
]
|
||||||
|
|
||||||
|
# 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']
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
.. _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 opening a new issue in the issue tracker, please include information about which *Operating System* you're using, and which version of *Bash*.
|
||||||
|
* In many cases, it also makes sense to show which Bash-it plugins you are using.
|
||||||
|
This information can be obtained using ``bash-it show plugins``.
|
||||||
|
* If the issue happens while loading Bash-it, please also include your ``~/.bash_profile`` or ``~/.bashrc`` file,
|
||||||
|
as well as the install location of Bash-it (default should be ``~/.bash_it``\ ).
|
||||||
|
* 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.
|
||||||
|
* 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>`_.
|
||||||
|
* 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 `Travis CI <https://travis-ci.org/Bash-it/bash-it>`_\ , where the test suite is run on both Linux and macOS.
|
||||||
|
The Pull Request will then show the result of the Travis 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 repo itself, as they will add unnecessary bloat to 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.
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
.. _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:
|
||||||
|
|
||||||
|
|
||||||
|
* ``lib/composure.bash``
|
||||||
|
* Files in ``lib`` with the exception of ``appearance.bash`` - this means that ``composure.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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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>`_.
|
||||||
|
|
@ -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!
|
||||||
|
|
@ -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>`.
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
.. _misc:
|
||||||
|
|
||||||
|
Misc
|
||||||
|
----
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Pass function renamed to passgen
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The Bash-it ``pass`` function has been renamed to ``passgen`` in order to avoid a naming conflict with the `pass password manager <https://www.passwordstore.org/>`_.
|
||||||
|
In order to minimize the impact on users of the legacy Bash-it ``pass`` function, Bash-it will create the alias ``pass`` that calls the new ``passgen`` function if the ``pass`` password manager command is not found on the ``PATH`` (default behavior).
|
||||||
|
|
||||||
|
This behavior can be overridden with the ``BASH_IT_LEGACY_PASS`` flag as follows:
|
||||||
|
|
||||||
|
Set ``BASH_IT_LEGACY_PASS`` to 'true' to force Bash-it to always **create** the ``pass`` alias to ``passgen``\ :
|
||||||
|
|
||||||
|
|
||||||
|
* ``export BASH_IT_LEGACY_PASS=true``
|
||||||
|
|
||||||
|
Unset ``BASH_IT_LEGACY_PASS`` to have Bash-it **return to default behavior**\ :
|
||||||
|
|
||||||
|
|
||||||
|
* ``unset BASH_IT_LEGACY_PASS``
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
sphinx == 3.2.1
|
||||||
|
sphinx-rtd-theme==0.5.0
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
.. _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=' '
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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 ✓ ❯
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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"``
|
||||||
|
|
@ -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 ✗|] $
|
||||||
|
|
@ -0,0 +1,570 @@
|
||||||
|
.. _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:
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
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:
|
||||||
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
.. _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``\ )
|
||||||
|
* ``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
|
||||||
|
* ``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.
|
||||||
|
|
@ -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"``
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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]
|
||||||
|
→
|
||||||
|
Before Width: | Height: | Size: 962 KiB After Width: | Height: | Size: 962 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue