Giter Club home page Giter Club logo

physine / macros-cli Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 17 KB

Macros-CLI is a Java-based command-line tool for managing macros via a RESTful API. It supports Create, Read, Update, and Delete (CRUD) operations, offering a user-friendly interface for interacting with macros. Built using Apache Commons CLI and Java HttpClient, it simplifies macro management through efficient command-line operations

License: MIT License

Java 100.00%

macros-cli's Introduction

About

macros-cli is a front-end command-line interface tool designed to interact with the Macros backend service. It offers a convenient way to perform CRUD operations on macros via simple CLI commands, leveraging the functionalities provided by the backend service.

Macros-CLI

Macros-CLI is a command-line interface tool for managing macros through a RESTful API. It simplifies the process of creating, retrieving, updating, and deleting macros with easy-to-use command-line operations. Built in Java, it leverages the Apache Commons CLI for parsing command-line arguments and Java HttpClient for HTTP requests, ensuring a smooth and efficient user experience.

Features

  • Create Macros: Easily add new macros with custom triggers and targets.
  • Retrieve Macros: Fetch a list of all existing macros.
  • Update Macros: Modify details of existing macros.
  • Delete Macros: Remove macros that are no longer needed.

Installation

Clone the repository:

git clone https://github.com/yourusername/macros-cli.git
cd macros-cli

Package the project

mvn package

Macro Command Output Formatting

The macro command provides a neatly formatted table output for better readability. This is particularly useful when retrieving a list of macros. Here's what you can expect:

Table Formatting

  • Column Headers: The output includes headers for each column: 'ID', 'Trigger', and 'Target'.
  • Row Alignment: Each row in the table aligns with the headers, presenting the data in an organized manner.
  • ID Indentation: The 'ID' column values are indented by one space for visual clarity.
  • Separator Lines: A line of dashes separates the headers from the rows, with plus signs aligning with the column dividers.
  • Readable Layout: The table layout ensures that the data is easy to read and understand, with each macro represented as a row in the table.

Usage

Run macro with the following options:

  • Create a New Macro:

    • Command: -c, --create <target> <trigger>
    • Description: Create a new macro. Requires target and trigger as arguments.
  • Delete a Macro:

    • Command: -d, --delete <id>
    • Description: Delete a macro. Requires the macro ID.
  • Display Help:

    • Command: -h, --help
    • Description: Display help information about commands.
  • Retrieve All Macros:

    • Command: -r, --retrieve
    • Description: Retrieve all macros.
  • Update an Existing Macro:

    • Command: -u, --update <id> <target> <trigger>
    • Description: Update an existing macro. Requires macro ID, target, and trigger.

Example Output

When you run the macro -r command, the output will look like this:
Note: You do not need to start macro triggers with !, I just find that it works well to avoid accidentally triggering macros.

| ID  | Trigger   | Target                           |
|-----|-----------|----------------------------------|
| 1   | !example  | http://example.com               |
| 2   | !shortcut | /path/to/directory               |
| 3   | !alias    | [email protected]                |
| 4   | !cmd      | Custom Command                   |
| 5   | !link     | https://www.example-link.com/    |

Environment Setup Instructions

In addition to setting up the Java environment, you can configure your system to run the macro command from anywhere in the command line by updating the PATH environment variable.

Adding macro to the PATH

  1. Locate the macro Executable:

    • Find the directory where your macro executable (or script) is located, it should look like:
      @echo off
      java -jar macros-cli-1.0.jar %*
    • and it might be in C:\path\to\macros-cli on Windows or /path/to/macros-cli on Unix-like systems.
  2. Update the PATH Environment Variable

Contributing

Contributions are welcome! Feel free to submit pull requests, open issues, or suggest improvements.

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.