Installs YARN via npm if not found; then runs yarn install Note that yarn install is skipped if package.json and yarn.lock haven't changed since the last run of yarn install.
Prints to STDOUT the SHA based on package.json and yarn.lock
Set file to be ignored by Dropbox
Set a file or directorhy to be ignored by Dropbox
Possible Bash It Powerline Prompt Modules
aws_profile battery clock command_number cwd dirstack gcloud go history_number hostname in_toolbox in_vim k8s_context last_status node python_venv ruby scm shlvl terraform user_info wd
Installs Bash-It Framework
Provides helper functions for dealing with asciidoc format.
Installs gem "rouge" and prints all available themes
Checks if we have debug mode enabled
Local debugging helper, activate it with export BASHMATIC_DEBUG=1
For each passed argument checks if it's installed.
OS-independent way to determine screen width.
OS-independent way to determine screen height.
Prints a "arrow-like" line using powerline characters
- @arg1 Width (optional) — only intepretered as width if the first argument is a number.
- @args Text to print
Makes a file executable but only if it already contains a "bang" line at the top.
Utilities for managing the $PATH variable
- path.strip-slash()
- path.dirs()
- path.dirs.size()
- path.dirs.uniq()
- path.dirs.delete()
- path.uniq()
- PATH.uniqify()
- path.append()
- path.prepend()
- path.mutate.uniq()
- path.mutate.delete()
- path.mutate.append()
- path.mutate.prepend()
- path.absolute()
Removes a trailing slash from an argument path
Prints a new-line separated list of paths in PATH
- @arg1 A path to split, defaults to $PATH
Prints the tatal number of paths in the path argument, which defaults to $PATH
Prints all folders in $PATH, one per line, removing any duplicates, Does not mutate the $PATH
Deletes any number of folders from the PATH passed as the first string argument (defaults to $PATH). Does not mutate the $PATH, just prints the result to STDOUT
- @arg1 String representation of a PATH, eg "/bin:/usr/bin:/usr/local/bin"
- @arg2 An array of paths to be removed from the PATH
Removes duplicates from the $PATH (or argument) and prints the results in the PATH format (column-joined). DOES NOT mutate the actual $PATH
Using sed and tr uniq the PATH without re-sorting it.
Appends a new directory to the $PATH and prints the result to STDOUT, Does NOT mutate the actual $PATH
Prepends a new directory to the $PATH and prints to STDOUT, If one of the arguments already in the PATH its moved to the front. DOES NOT mutate the actual $PATH
Removes any duplicates from $PATH and exports it.
Deletes paths from the PATH provided on the command line
Appends valid directories to those in the PATH, and exports the new value of the PATH
Prepends valid directories to those in the PATH, and exports the new value of the PATH
Returns an absolute version of a given path
Datadog Agent Functions
This function starts datadog agent, if it's not already running.
True if .envrc.local file is present. We take it as a sign you may be developing bashmatic.
This function returns 1 if bashmatic is installed in the location pointed to by ${BASHMATIC_HOME} or the first argument.
-
$1 The location to check for bashmatic instead of $ {BASHMATIC_HOME}
Helpers to install gawk and shdoc properly.0
see ${BASHMATIC_HOME}/lib/shdoc.md
for an example of how to use SHDOC.
and also project's github page.
Installs gawk into /usr/local/bin/gawk
Pass in a value eg. 32GB or 16M and it returns back the number of bytes
This function receives up to three arguments:
- @arg1 A number of bytes to convert into a more human-friendly format
- @arg2 An optional printf format string, defaults to '%.1f'
- @arg3 An optional suffix ('b' or "B" or none at all)
Prints the background color of the terminal, assuming terminal responds to the escape sequence. More info: https://stackoverflow.com/questions/2507337/how-to-determine-a-terminals-background-color
Returns true if PostgreSQL is running locally
if one or more PostgreSQL instances is running locally, prints each server's binary +postgres+ file path
For each running server prints the data directory
Grab the version from postgres
binary in the PATH and remove fractional sub-version
p7zip conversions routines.
This file contains many useful functions for handling directories, sync'ing and copying from and to directories, and so on.
Returns the first folder above the given that contains a file.
- @arg1 file without the path to search for, eg ".evnrc"
- @arg2 Starting file path to seartch
Replaces the first part of the directory that matches ${HOME} with '~/'
Rsyncs the files from a "from" directory specified by the first argument, to the to directory specified by the second.
- @arg1 The source locl directory
- @arg2 The destination locl directory
- @arg3 optional
--sudo
: runs rsync in sudo mode. Careful! - @arg4 Any additional arguments to rsync such as --verbose
This is a variation on the above that preserves extended attributes of the source files, such as icons for direcories. When copying a folder from the Mac OS-X this is recommended.
This is a variation on the above that preserves extended attributes of the source files, such as icons for direcories, and add --verbose to rsync flags so that you can the files being synced.
Get current format
Set the default config file
Get the file name
Reads the value from a two-level configuration hash
- @arg1 hash key
- @arg2 hash sub-key
Uses jq
utility to format JSON with color, supports partial
Returns true if NVM_DIR is correctly set, OR if a directory passed as an argument contains nvm.sh
Returns success and exports NVM_DIR whenver nvm.sh is found underneath any of the possible locations tried.
Installs NVM via Curl if not already installed.
Loadd
Uses pingless connection to check if a remote port is open Requires sudo for UDP
- @arg1 host
- @arg2 port
- @arg3 [optional] protocol (defaults to "tcp", supports also "udp")
Renames files matching the input parameters to find
by
replacing spaces with dashes and lower casing the file.
Miscellaneous utilities.
Finds the exact absolute path of the uname
utility on a unix file system.
Generates a random number up to 1000000
Generates a password of a given length
Generates a random string of a given length
Adds a variable to the list of the variables to be obfuscated
Prints values of all variables starting with prefixes in args
Add direnv hook to shell RC files
Add direnv hook to shell RC files
Regenerates USAGE.adoc && USAGE.pdf
shrinkgs PDF
- rb.ruby.report()
- rb.ruby.describe()
- rb.jemalloc.detect-or-exit()
- rb.jemalloc.stats()
- rb.jemalloc.detect-quiet()
- rb.jemalloc.detect-loud()
- usage()
prints the info about current version of ruby
Prints ruby version under test
detects jemalloc or exits
prints jemalloc statistics if jemalloc is available
returns 0 if jemalloc was detected or 1 otherwise
detects if jemalloc is linked and if so prints the info to output
Prints the help screen and exits
Manually Download and Install ShellCheck
- Copyright © 2017-2024 Konstantin Gredeskoul, All rights reserved.
- Distributed under the MIT License.