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

pluc

v0.1.3

Published

Create permanent terminal aliases instantly

Downloads

6

Readme

pluc

NPM version Build Status XO code style

:ok_hand: Create permanent terminal aliases instantly

Install

$ npm install --global pluc

Now source the pluc output file in your shell. Paste this in your bash profile (~/.bashrc, ~/.zshrc, ~/.bash_profile, , or ~/.profile).

source "$(pluc-cli --destinationPath)"
function pluc() {
  pluc-cli "$@"
  source "$(pluc-cli --destinationPath)"
}

That also sets up a function to immediately source new aliases. Should you ignore the above bash code, you'd need to manually resource the pluc shell file per session and after adding a new alias.

Verify Installation

$ pluc --sourcePath
# Should output a json filepath, not an error.

Your bash aliases are generated from that JSON object. You don't need to pay attention to that in most cases. That's covered in depth in the "About" section below.

Usage

Save a new alias forever

$ pluc <alias> <command>

Leave out command and pluc will infer your last entered command

$ pluc <alias>

Examples

Imagine you ssh to this machine often:

$ ssh [email protected]
# ssh: Successfully ssh'd to example.org!

But truly, you do that most days. Why should you type it out?

$ pluc sshme
# 👌 Aliased "sshme" to "ssh [email protected]" 👌

$ sshme
# ssh: Successfully ssh'd to example.org!

Not only is the alias sshme instantly available, it's forever available in any new sessions. The alternative is to save an alias in your bash profile. It's not only time consuming to open and edit, but you won't be able to use that alias until you source it.

Or let's say you do web development and need a web server often:

$ pluc serve "python -m SimpleHTTPServer"
# 👌 Aliased "serve" to "python -m SimpleHTTPServer" 👌

$ serve
# Serving HTTP on 0.0.0.0 port 8000 ...

Although it's always recommended that you quote the command for safety with bash argument splitting, your second argument can contain spaces! Parsing of this is done on your behalf by pluc. If your command contains flags though, you must quote it, which is why it's not a good habit.

If you want to see the full list of commands:

$ pluc --help

About

pluc uses a single JSON object to store aliases. Since JSON is already key-value based, it's a perfect data format. To manually edit the JSON source file (you absolutely will eventually) enter

$ $EDITOR $(pluc --sourcePath)

After any new alias is added to pluc, the render function is called which builds a shell file. The shell output is what you source'd at the very beginning. To see it right now, enter

$ $EDITOR $(pluc --destinationPath)

:warning: Do not edit the output shell file, it gets deleted on re-render (often) :warning:

Backup important aliases

Are you saving important aliases or a large amount of them? If so, back these up.

Backup to Dropbox

First find the path your config file is saved in:

$ pluc --sourcePath
# /Users/dawsonbotsford/Library/Preferences/pluc-nodejs/config.json

This file needs to be moved into Dropbox and symlinked back to the original location

mv /Users/dawsonbotsford/Library/Preferences/pluc-nodejs/config.json ~/Dropbox/
ln -s ~/Dropbox/config.json /Users/dawsonbotsford/Library/Preferences/pluc-nodejs/config.json

Backup to git

Alternatively, use git to manually version control.

$ pluc --sourcePath
# /Users/dawsonbotsford/Library/Preferences/pluc-nodejs/config.json
$ cd /Users/dawsonbotsford/Library/Preferences/pluc-nodejs
$ git init
# add remote, and push!

FAQ

  • Why not use the source command in my terminal?

    • source is only available within your current shell. As soon as you start a new session, your alias is gone.
  • How can I edit my aliases?

    • $ $EDITOR $(pluc --sourcePath)
  • Why store the data as a JSON object?

    • If JSON objects are used as the source of truth, a variety of render methods can be used. This means that any output format (vimrc, sublime snippets, etc.) which is key-value based can be generated using pluc.
  • What's one of these "pluc JSON objects" actually look like?

{
  "gi": "git init",
  "ga": "git add"
}
  • The history inferred by pluc <alias> alone is not accurate.

Compatibility Issues

  • pluc will not create valid aliases on Windows. Windows does not save terminal history.

  • pluc will not work with fish shell. It likely will not work for shells beyond bash or zsh. This is because of the parse function in @dawsbot/shell-history package. PR's welcome.

License

MIT © Dawson Botsford