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

foji

v0.9.1

Published

Forge your code in a new way.

Downloads

82

Readme

Foji ⚒️

Foji is a powerful command-line interface (CLI) tool designed to streamline and automate long or repetitive commands in your daily workflow. With Foji, you can define and execute custom commands, integrate custom parameters, and simplify complex processes, reducing the need to repeatedly type lengthy commands.

🚀 Features

  • [x] Run custom commands with flexible argument handling.
  • [x] Supports options, conditional, and spread arguments for advanced customization.
  • [x] Easily add, edit and remove commands in the CLI.
  • [x] Sync configuration to the cloud.

📦 Installation

[!IMPORTANT] Foji requires Node.js to be installed on your system. Make sure you have it installed before proceeding.

To install Foji, run the following command:

npm i foji -g

🚦 Usage

Foji stores your commands and configurations in its configuration file (~/.config/foji.json). You can access it using:

foji config

Or open it directly:

foji config -f

Running a Command

To execute a saved command:

foji [command name] [...command args]

[!TIP] If you don’t provide a valid command name, Foji will list all available commands, including default commands like add, remove, and sync, along with any custom commands you've added.

Skipping an Argument

If you want to skip an optional argument, use the _ symbol:

foji [command name] [arg1] _ [arg3]

⚙️ Configuration Management

Foji allows you to easily create and update your command configurations.

Adding a New Command

To add a new command to the configuration:

foji add [command name] [command]

Supported argument types:

  1. Required Arguments:
    These arguments must be provided for the command to run.

    "command": "echo <requiredArgumentOne> <requiredArgumentTwo>"
  2. Optional Arguments:
    These arguments are not mandatory. If not provided, they will be skipped.

    "command": "echo <requiredArgumentOne> <optionalArgumentOne?>"
  3. Optional Arguments with Default Values:
    If not provided, a default value will be used.

    "command": "echo <requiredArgumentOne> <optionalArgumentOne ?? My Default Value>"
  4. Ternary Arguments:
    Works as a boolean argument, only checking whether it was passed.

    "command": "echo i want pizza of <requiredArgumentOne> with <hasCheese ? cheese : no cheese>"
  5. Spread Argument:
    Catches all the remaining arguments.

    "command": "echo [<argOne>] {<argTwo...>}"

Example of usage:

foji command "my arg one" one two three --my --options

The resulting final command would be:

echo [my arg one] {one two three --my --options}

[!IMPORTANT]
Always provide required arguments before any optional ones.

Removing a Command

To remove a command:

foji remove [command name]

🌐 Cloud Sync

You can easily sync your configurations using cloud services.

[!NOTE] Foji uses Github CLI to create, read and update your configuration gist.

Upload Configuration

To upload your configuration to a gist (or create a new gist if one doesn’t exist):

foji upload

Download Configuration

To download a configuration file from a gist:

foji download [gist url]

Sync Configuration

To sync your local configuration with its URL:

foji sync

[!CAUTION] Be careful when syncing from external sources. Always verify the origin of the gist to avoid overriding your custom commands.

🛠️ Development

If you want to contribute or customize Foji, follow these steps:

  1. Clone the repository:

    git clone https://github.com/imLymei/foji.git
    cd foji
  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build:local

📜 Credits

This project makes use of several open-source libraries and tools. Special thanks to the following:

📄 License

Foji is licensed under the MIT License.

See the LICENSE file for more information.