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

digup

v1.1.2

Published

A handy command line tool written in javascript made for extensive text search. Very frequent, streamlined, increasingly awesome text search.

Downloads

2

Readme

digup

digup

A handy command line tool written in javascript made for extensive text search.
Very frequent, streamlined, increasingly awesome text search.

It's dead simple, pretty fast, and leverages a super-straightforward syntax (no dashed options are required to kickoff a basic search, and few awesome ones are available overall) which makes it a perfect tool for frequent project searches - eg. finding @todos in the current project (cwd) is as easy as digup . @todo.

! New in version 1.1.0 - LINE EXPANSION feature (read below) !

version dependencies npm node tested

Speed: Wordpress directory / 2371 files / 639927 lines / 2 arguments / ~0.6 seconds.

Install

$ [sudo] npm install -g digup

Usage

# Standalone mode
$ digup <path> [query-args] [options]

# Pipeline mode
$ <command-outputting-file-paths> | digup [query-args] [options]

Examples

Standalone mode

$ digup . @todo @frontend popup

This example will go down your current directory tree (.), scan files (as individual lines) searching for the keywords @todo,@frontend and popup to appear on the same line.

Pipeline mode

$ ls -1 | digup @todo @frontend popup

This example will do the exact same thing as the example above, but instead of going trough all the files it can find down the current directory tree, it will operate on the paths outputted by ls -1 (which lists the current directory only) in a single column.

Expand to get the context

$ <standalone/pipeline> -e21

The lines outputted will take the following form:

<match-id>: <file-path>[<line-number>] <line-content>

For the sake of the argument, let's say you had about 30 of the lines matching the search criteria, and the 21st registered matched line is:

21: ./file/path.js[48]  * @todo Finish up the popups @frontend

Appending to the examples above with an -e (--expand) option, we will enter an "expanded" mode of the matched line, where we use the previously obtained match-id to preview it's surrounding context. Adding -e21 (it's match-id) to the end of the previous example command will print the 10 lines surrounding the matched line (5 before and 5 after). Default value is 5, but it can be changed by providing a second argument in the form of -e21/<number-of-lines-on-each-side>.

So now the output could look something like this:

    ./file/path.js[42]  * My awesome function
    ./file/path.js[43]  *
    ./file/path.js[44]  * @param {number} pad   - Description
    ./file/path.js[45]  * @param {string} input - Description
    ./file/path.js[46]  *
21: ./file/path.js[48]  * @todo Finish up the popups @frontend
    ./file/path.js[49]  *  - task 1
    ./file/path.js[50]  *  - task 2
    ./file/path.js[51]  *  - task 3
    ./file/path.js[52]  */
    ./file/path.js[53]  function myAwesomeFunction (pad,input) {

Basically, by adding -e21 to your command, you have a whole context of the particular result.

Beyond digging

$ <standalone/pipeline> -e21 -p

Take a notice of the -p flag here, since this example extends the previous ones. When using the extended context (-e,--extend) you have an option to pass the pick flag (-p,--pick) which will only output the path of the file that contained the line under an ID chosen by the extender.

In the case of our example, the output would be:

./file/path.js

You can now pipe this output further (eg. xargs cat which will read the whole file so you can proceed with an inspection beyond digging).

Upcoming release notes

  • ~~Include options for output formatting and line expansion~~ > Featured in 1.1.0
  • Enable search on stdin
  • Enable full regex search
  • Enable case sensitivity option
  • Enable pseudo regex search (!,|,*)

Changelog

  • 1.1.2
    • Fixing a missing dependency in package.json
  • 1.1.1
    • Fixing the loosely published npm package
  • 1.1.0
    • Adding line expansion
    • Adding "pick" option
    • Moving all of the cli logic to bin/digup so the package can be required in other projects without relying on the command line
  • 1.0.4
    • First stable copy

License

Copyright 2015 Nikola Kanacki ([email protected])

This project is free software released under the MIT/X11 license:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.