Categorygithub.com/leep-frog/command
modulepackage
0.0.0-20240422232310-6f3d57286155
Repository: https://github.com/leep-frog/command.git
Documentation: pkg.go.dev

# README

Command

github.com/leep-frog/command is a Go package for writing custom bash commands in Go! Some of the most valuable benefits of this package include:

See the following docs folders for more info:

Installation

TODO: Update this section to use user's go module instead of this repo directly.

  1. Download this repository locally:

    export $LEEP_INSTALLATION_PATH=/some/path
    pushd $LEEP_INSTALLATION_PATH > /dev/null
    git clone https://github.com/leep-frog/command.git
    popd > /dev/null
    
  2. Add the following to your bash profile:

    source $LEEP_INSTALLATION_PATH/command/sourcerer/cmd/load_sourcerer.sh
    
  3. Reload your shell and you're done!

Writing Your First Command

There are a couple of ways to get started. Some people love reading through a good doc, while others prefer to get their hands on examples right away. The following two sub-sections should hopefully satiate both of those approaches.

Building Blocks Docs

Example

The steps from the Installation section will create a new bash CLI called sourcerer. You can use this command to generate entirely new bash CLIs written completely in Go!

To get an idea of how to write your own commands, start with an example:

  1. Download the example_main.go file locally and read through the file to become familiar with CLI setup (the file is thoroughly commented).

  2. cd into the local directory containing the example_main.go file.

  3. Run sourcerer . my_custom_clis (and add this line to your bash profile to automatically load this command from now on).

You are now able to use the mfc command in your bash shell! Try out the following runs and see what happens:

  • mfc
    
  • mfc $USER
    
  • mfc <tab><tab>
    
  • mfc B<tab><tab>
    
  • mfc Br<tab>
    
  • mfc there 10
    
  • mfc World -f 10
    

To explore a more thorough explanation of all this package can do, check out the docs/features folder

# Packages

No description provided by the author
Package color makes it easy to output formatted text (via tput or output codes depending on the operating system).
Package command provides classes and functions for defining custom CLIs.
No description provided by the author
Package commandertest contains test functions for running execution and autocompletion tests.
No description provided by the author
No description provided by the author
This file was copied from C:\Program Files\Go\src\log\log.go the only modification being not automatically adding a newline after files.a.
package sourcerer sources CLI commands in a shell environment.