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

@magicdawn/x-args

v1.5.4

Published

play with cli commands like a composer

Downloads

81

Readme

x-args

play with cli commands like a composer

Build Status Coverage Status npm version npm downloads npm license

Install

$ pnpm add @magicdawn/x-args -g

# or
$ pnpm dlx @magicdawn/x-args
$ pnpx @magicdawn/x-args
$ bunx @magicdawn/x-args

Commands

x-args command

x-args -f './*.*' -c $'cwebp :file -o \':dir/:name_compressed.:ext\''

use -t to show available tokens

txt sub command

# use :line
x-args txt ./to-be-processed.txt -c 'echo :line'

features that native xargs does not have

  • comment, x-args txt support // or # comment, I suggest use .conf extenstion, so that editors can recognize # comment
  • live reload, x-args txt read txt file, exec command, and read txt again, so edit after command start will works as well
  • wait input update: use -w,--wait, so that this command will not exit but to wait txt file update. use --wait-timeout 1h to delay 1h 1 hour.

Templates

  • use :line for whole line
  • use :args0 / :arg0 for single arg
  • use -s / --split / --args-split to specify how to turn :line to :args0, default using /\s+/

when input is a filepath, and may contains space, use a different separator that has low possibility occurs in a filepath for example

  • ancient chinese character for Simplified chinese user: __纛恚掾旒__, --args-split '__纛恚掾旒__', 出处
  • english user, maybe a emoji combination ?

Tips

-c,--command

if need single quote in -c,--command, u can use -c $'command \'inside-a-quote\'', a special shell syntax learn from zx, see

  • https://github.com/google/zx/blob/main/docs/quotes.md#quotes
  • https://stackoverflow.com/a/16605140

:line / :arg0

this will be auto escaped, no need to manual quote, just use plain :line / :arg0

retry

if your -c,--command may fail, and u need retry it. u can use https://npm.im/retry-cli

# install globally
pnpm add -g retry-cli

# add retry to `command-may-fail`
x-args txt ./to-be-processed.txt -c 'retry -- command-may-fail :line'

# retry times 1000, default: 10, see retry-cli homepage
x-args txt ./to-be-processed.txt -c 'retry -n 1000 -- command-may-fail :line'

Changelog

CHANGELOG.md

License

the MIT License http://magicdawn.mit-license.org