github.com/avvmoto/glide@v0.12.3/docs/plugins.md (about)

     1  # Glide Plugins
     2  
     3  Glide supports a simple plugin system similar to Git.
     4  
     5  ## Existing Plugins
     6  
     7  Some plugins exist today for Glide including:
     8  
     9  * [glide-vc](https://github.com/sgotti/glide-vc) - The vendor cleaner allows you to strip files files not needed for building your application from the `vendor/` directory.
    10  * [glide-brew](https://github.com/heewa/glide-brew) - Convert Go deps managed by glide to Homebrew resources to help you make brew formulas for you Go programs.
    11  * [glide-hash](https://github.com/mattfarina/glide-hash) - Generates a hash of the `glide.yaml` file compatible with Glides internal hash.
    12  
    13  _Note, to add plugins to this list please create a pull request._
    14  
    15  ## How Plugins Work
    16  
    17  When Glide encounters a subcommand that it does not know, it will try to delegate it to another executable according to the following rules.
    18  
    19  Example:
    20  
    21  ```
    22  $ glide install # We know this command, so we execute it
    23  $ glide foo     # We don't know this command, so we look for a suitable
    24                  # plugin.
    25  ```
    26  
    27  In the example above, when glide receives the command `foo`, which it does not know, it will do the following:
    28  
    29  1. Transform the name from `foo` to `glide-foo`
    30  2. Look on the system `$PATH` for `glide-foo`. If it finds a program by that name, execute it...
    31  3. Or else, look at the current project's root for `glide-foo`. (That is, look in the same directory as `glide.yaml`). If found, execute it.
    32  4. If no suitable command is found, exit with an error.
    33  
    34  ## Writing a Glide Plugin
    35  
    36  A Glide plugin can be written in any language you wish, provided that it can be executed from the command line as a subprocess of Glide. The example included with Glide is a simple Bash script. We could just as easily write Go, Python, Perl, or even Java code (with a wrapper) to
    37  execute.
    38  
    39  A glide plugin must be in one of two locations:
    40  
    41  1. Somewhere on the PATH
    42  2. In the same directory as `glide.yaml`
    43  
    44  It is recommended that system-wide Glide plugins go in `/usr/local/bin` or `$GOPATH/bin` while project-specific plugins go in the same directory as `glide.yaml`.
    45  
    46  ### Arguments and Flags
    47  
    48  Say Glide is executed like this:
    49  
    50  ```
    51  $ glide foo -name=Matt myfile.txt
    52  ```
    53  
    54  Glide will interpret this as a request to execute `glide-foo` with the arguments `-name=Matt myfile.txt`. It will not attempt to interpret those arguments or modify them in any way.
    55  
    56  Hypothetically, if Glide had a `-x` flag of its own, you could call this:
    57  
    58  ```
    59  $ glide -x foo -name=Matt myfile.txt
    60  ```
    61  
    62  In this case, glide would interpret and swollow the -x and pass the rest on to `glide-foo` as in the example above.
    63  
    64  ## Example Plugin
    65  
    66  File: glide-foo
    67  
    68  ```bash
    69  #!/bin/bash
    70  
    71  echo "Hello"
    72  ```