npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

miniprompt.sh

v0.1.2

Published

Minimal and versatile bash prompt

Downloads

6

Readme

About

🎁 Features

  • Colored exit status
  • Easily configurable
  • Fully customizable: colors, symbols, the prompt itself, and more...
  • Better history
  • Better completion
  • Directory colors support
  • Trimming path
  • Various extensions
    • Git
    • Kubernetes
    • SSH
    • IP address
    • WIFI
  • Extensions can be toggled on and off on the fly

🤖 Usage

📦 Installation

Make sure you have the following programs installed in your system:

  • GNU Make
  • git
  • npm (for the npm installer)
  • General utilities like grep, sed, awk, ...
  • A patched Nerd Font (optional)

NPM

$ npm install --global miniprompt.sh

If it throws an error then run the command with sudo

Manual

$ git clone [email protected]:Pocco81/MiniPrompt.git && cd MiniPrompt
$ make install

Installs the prompt under your local bins: ~/.local/bin. Make sure this directory is in your $PATH; if it's not, paste this into your ~/.bashrc:

export PATH=$PATH:"$HOME/.local/bin"

AUR

👷🛑 Under dev

🔧 Setup

Two things:

  1. Enable the prompt in your ~/.bashrc
  2. Configure it

To enable the prompt paste this into your ~/.bashrc:

alias mp="source miniprompt"
mp

After that, feel free to customize the prompt to your like using the conf.toml file (located under ${XDG_CONFIG_HOME}/miniprompt/conf.toml. If the $XDG_CONFIG_HOME env var is not set then it'll be assumed to be $HOME/.config/).

Here is the default config:

# MiniPrompt's config file
[behaviour]
colored_exit_status = true			# prettify the exit status of the previous command
dirtrim = 2			# trim the CWD to only show x number of dirs
enhanced_autocompletion = true			# completion maps, tilde expansion, mark directories, ...
enhanced_history_format = true			# better format for your shell history: [%Y-%m-%d %T]
dircolors = true			# color directories

[primary_prompt]
prefix = "\[\e]0;\w\a\]"			# prompt prefix
ps_content = "</yellow>\w</nc> "			# the actual content of your prompt
ps_suffix = "</green>➜</nc> "		# after the ps_content
normal_color = "nc"			# the color text is defaulted to
error_symbol = "✗"			# symbol to use after the previous command failed
failed = "red"			# $error_mark's color after the previous command executed successfully

[extensions]
ext_git = false			# enable git extension (shows current working branch)
ext_ssh = false			# enable ssh expansion (shows <user>@<machine>)
ext_package = false			# enable package expansion (shows project's current version)
ext_kubernetes = false			# enable kubernetes extension (shows kubernetes' current context)
ext_ip = false			# enable kubernetes extension (shows kubernetes' current context)
ext_wifi = false
git_struct = "</cyan> </unit> "		# structure of the integration
ssh_struct = "</magenta> </unit> " # structure of the integration
package_struct = "</white> v</unit> " # structure of the integration
ip_struct = "</gray_br>  </unit> " # structure of the integration
wifi_struct = "</blue>直 </unit> " # structure of the integration
hierarchy = "ssh, git, ip, wifi, package" # order in which the extensions are displayed

Customizing!

Prompt

The prompt itself can be changed modifying the ps_content and ps_suffix variables. Apart from giving your prompt different colors using the tags, you can also modify the information displayed using the following built-in Bash options:

| Opts | Description | | ------------ | ------------------------------------------------------- | | \a | A bell character | | \d | Date (day/month/date) | | \D{format} | Date but following the system's time format | | \e | Escape character | | \h | Hostname (short) | | \H | Full hostname (domain name) | | \j | Number of jobs being managed by the shell | | \l | The basename of the shells terminal device | | \n | New line | | \r | Carriage return | | \s | The name of the shell | | \t | Time (hour:minute:second) | | \@ | Time, 12-hour AM/PM | | \A | Time, 24-hour, without seconds | | \u | Current username | | \v | BASH version | | \V | Extra information about the BASH version | | \w | Current working directory | | \W | The basename of the working directory | | \! | Lists this command’s number in the history | | \# | This command’s command number | | \$ | Specifies whether the user is root (#) or otherwise ($) | | \\ | Backslash | | \[ | Start a sequence of non-displayed characters | | \] | Close or end a sequence of non-displayed characters |

Structs

Structs define the structure of the extensions. You can use tags to customize the structs further. However, there is an additional tag called </unit>, which is the output of the extension. Say you are using the git extension:

git_struct = "</cyan> </unit> "

This will display:

 dev

Because </unit>, in this case, displays the current working branch.

Tags

| Tag | Description | | ------------ | -------------------------------------- | | </gray> | Makes text following it gray | | </red> | Makes text following it red | | </green> | Makes text following it green | | </blue> | Makes text following it blue | | </cyan> | Makes text following it cyan | | </yellow> | Makes text following it yellow | | </magenta> | Makes text following it magenta | | </white> | Makes text following it white | | </nc> | Removes the color of text following it |

You can also give some properties to the colors by using modifiers and appending them at the end of the color (e.g. <green_br>):

| Modifier | Description | | -------- | ----------- | | _br | bright | | _dm | dim | | _it | italic | | _un | underlined | | _bl | blinking | | _re | inverted |

🌿 Utilization

On the fly commands

On the previous step we created the alias mp, which we will be using to run commands for MiniPrompt. Use mp --help to see the available commands. Here is a quick example enabling the Git extension:

$ mp git enable
# you can shorten it as: mp gt e

Reloading the prompt

After changing the config file you can reload the prompt using the same alias, but without any flags:

$ mp

Dependencies for extensions

| Extension | Dependencies | |-----------|--------------| | Git | git | | SSH | openssh | | Package | npm | | Wifi | nmcli | | IP | ip |

🙋 FAQ

  • Q: "If I don't have a config file, will MiniPrompt create one for me?"

  • A: No, settings will simply be assumed from default values.

  • Q: "Why does the alias created for the prompt needs to be sourced?"

  • A: Because you can't export env vars from a shell script unless it's sourced, so this is the best solution.

📜 License

MiniPrompt is released under the GPL v3.0 license. It grants open-source permissions for users including:

  • The right to download and run the software freely
  • The right to make changes to the software as desired
  • The right to redistribute copies of the software
  • The right to modify and distribute copies of new versions of the software

For more convoluted language, see the LICENSE file.

📋 TO-DO

High Priority:

  • Publish to the AUR?

Low Priority:

  • None