Giter Site home page Giter Site logo

command_formatter's Introduction

Command Formatter

A command-line tool to format a command string with specific rules.

Usage

  1. Run the tool and provide the command string as input:

    echo "my_command  positional-arg   --flag 1    --flag2     --flag  3" | ./command_formatter
    

    The formatted command string will be output to standard output.

Formatting Rules

The tool applies the following formatting rules to the command string:

  • Adds a backslash (\) after each positional argument.
  • Adds a backslash (\) after each flag argument, except for boolean flags.

Examples

Input:

my_command  positional-arg   --flag 1    --flag2     --flag  3

Output:

my_command \
positional-arg \
--flag 1 \
--flag2 \
--flag 3

Installation

Prerequisites

  • Rust (version 1.x or later)

Steps

  1. Clone the repository:

    git clone https://github.com/grepinsight/command-formatter.git
    
  2. Navigate to the project directory:

    cd command-formatter
    
  3. Install the project using Cargo:

    cargo install --path .
    

    This command will compile the code and install the command_formatter executable in your Cargo binary directory (usually $HOME/.cargo/bin).

    Note: Make sure that your Cargo binary directory is in your system's PATH environment variable. This allows you to run the command_formatter command from anywhere in your terminal.

    If the Cargo binary directory is not in your PATH, you can add it by modifying your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, etc.) and adding the following line:

    export PATH="$HOME/.cargo/bin:$PATH"
    

    After modifying the configuration file, restart your terminal or run source ~/.bashrc (or the appropriate command for your shell) to apply the changes.

License

This tool is released under the MIT License.

command_formatter's People

Contributors

grepinsight avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.