zpr
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

zpr

zpr (pronounced zeper or /ˈziːpər/) is a Node module that provides a simple programmatic way to construct zsh prompts.

Installation

npm i zpr

Usage

import Prompt from 'zpr';

const prompt = new Prompt()
  .colorOpen('red')
  .text('[')
  .cwdFromHome()
  .text(']')
  .colorClose()
  .text(' $ ');

console.log(prompt.toString());

Plug-n-Play Prompts

FAQ

How can I use this?

To set a prompt on the left side of your terminal, add the following to your ~/.zshrc:

PROMPT="$(node /path/to/your/script.js)"

To set a prompt on the right side of your terminal, add the following to your ~/.zshrc:

RPROMPT="$(node /path/to/your/script.js)"

If you use substitutions in your prompt, you'll need to use single quotes instead of double quotes.

Why?

To allow the easy creation of zsh prompts from within Node, instead of having to mess around with pesky shell scripts and percent signs.

CLI Support?

No, there is no CLI support (yet). If you want to use zpr in your shell, you'll have to write a wrapper script. However, I do plan on adding a CLI in the future.

/zpr/

    Package Sidebar

    Install

    npm i zpr

    Weekly Downloads

    1

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    40.2 kB

    Total Files

    26

    Last publish

    Collaborators

    • shreyasm-dev