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

terminal-shortcuts

v1.1.0

Published

Save time and keystrokes by defining shortcuts for often-visited paths when navigating folders in the terminal.

Downloads

34

Readme

terminal-shortcuts npm version Build Status

Save time and keystrokes by defining shortcuts for often-visited paths when navigating folders in the terminal.

~ $ ts-add proj /Users/me/Documents/projects

~ $ ts proj

~/Documents/projects $

Getting Started

The toolkit consists of three parts

  1. the ts-lookup tool
    • given a shortcut, this tool returns a target path
  2. the ts-add and ts-rm tools
    • adds and removes shortcut to/from the shortcut file
  3. batch and shell scripts
    • ts - batch script, acts like cd and changes directory to whatever the given shortcut expands to (windows only)
    • ts-cd / ts-pushd - shell script wrappers for cd and pushd, though these can't be run directly (read more below)

Install them all globally:

npm install terminal-shortcuts -g

Add some shortcuts:

$ ts-add docs /Users/user/Documents
$ ts-add proj /Users/user/Documents/projects

Test the setup in a terminal/console window: run ts-lookup <shortcut> and make sure it prints the corresponding target, e.g.:

$ ts-lookup docs
/Users/user/Documents

$ ts-lookup proj
/Users/user/Documents/projects

Shell setup (Linux / OS X)

Because shell scripts run in a sub-shell when executed, they cannot change directory of the parent shell. To make the ts-cd and ts-pushd scripts work as intended, set up aliases that source the scripts:

# create aliases
$ alias ts="source ts-cd"
$ alias tsp="source ts-pushd"

# use alias to change directory using the ts-cd script:
$ ts proj

# make sure we end up in the expected directory:
/Users/user/Documents/project $

If you use bash, add the aliases to ~/.bash_profile to make them available in all shells. Also, feel free to use whatever aliases you like - I prefer go rather than ts, but I guess it might clash if you're programming with go-lang.

Shortcut format

Define shortcuts in any of the following formats:

  • docs:/Users/user/Documents - maps a shortcut, docs to a path /Users/user/Documents
  • proj:<docs>/projects - maps a shortcut, proj to a path /Users/user/Documents/projects using another shortcut docs as base
  • src:<proj>/*/src - maps a shortcut src to a path /Users/user/Documents/projects/x/src using the current working directory as a base, i.e:
    • /Users/user/Documents/projects/project-a/src if the cwd is anywhere below /Users/user/Documents/projects/project-a
    • /Users/user/Documents/projects/project-b/src if the cwd is anywhere below /Users/user/Documents/projects/project-b
    • very useful for projects that have a deep, but known, directory structure and you need to navigate wihtin it regardless of what project you're currently working in

Also:

  • Any shortcut that is not found is treated as a literal folder name, so e.g. ts-lookup bogus will return bogus.
  • Arguments can be "chained" so that e.g. ts-lookup proj a dist docs will return /Users/user/Documents/projects/a/dist/docs, assuming that path exists

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

1.1.0

* added command `ts-add` to add shortcuts from the command line
* added command `ts-rm` to remove shortcuts from the command line

1.0.0

* Inital release