command

package module
v0.0.0-...-6f3d572 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 0 Imported by: 8

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package color makes it easy to output formatted text (via tput or output codes depending on the operating system).
Package color makes it easy to output formatted text (via tput or output codes depending on the operating system).
cmd
colorreset
Package colorreset provides a CLI that clears all color formatting done by the github.com/leep-frog/command/color package.
Package colorreset provides a CLI that clears all color formatting done by the github.com/leep-frog/command/color package.
Package command provides classes and functions for defining custom CLIs.
Package command provides classes and functions for defining custom CLIs.
Package commandertest contains test functions for running execution and autocompletion tests.
Package commandertest contains test functions for running execution and autocompletion tests.
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
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
internal
spycommand
Package spycommand is a package that contains types that are private in `command`, but needed for reference in other packages.
Package spycommand is a package that contains types that are private in `command`, but needed for reference in other packages.
spycommandertest
Package spycommandertest contains all test logic for this project
Package spycommandertest contains all test logic for this project
spycommandtest
Package spycommandtest contains additional test parameters that are only relevant for tests run inside of the `command` project.
Package spycommandtest contains additional test parameters that are only relevant for tests run inside of the `command` project.
package sourcerer sources CLI commands in a shell environment.
package sourcerer sources CLI commands in a shell environment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL