A CLI for managing declarative infrastructure.
Go to file
2019-06-06 09:29:07 -05:00
cmd Remove redundant code 2019-06-03 08:41:27 -05:00
hack Fix project structure to work with client-gen 2019-05-28 15:05:52 -05:00
pkg Spelling mistake 2019-06-05 10:04:43 -05:00
test Move workflow listing to its own package 2019-05-31 15:57:07 -05:00
tools Enable the linter, and fix uncovered linting issues 2019-05-30 10:02:54 -05:00
.gitignore Add a bin packer 2019-05-15 16:10:50 -05:00
.travis.yml Add .travis.yml 2019-06-06 09:21:20 -05:00
Dockerfile Update the Dockerfile to account for static builds 2019-05-17 10:19:58 -05:00
go.mod Move workflow listing to its own package 2019-05-31 15:57:07 -05:00
go.sum Move workflow listing to its own package 2019-05-31 15:57:07 -05:00
main.go Fix an issue causing command line args to be parsed too late 2019-05-30 09:54:26 -05:00
Makefile Remove coverage tests 2019-06-06 08:59:59 -05:00
README.md Update README with build status 2019-06-06 09:29:07 -05:00

Build Status

airshipctl

Custom Plugins Tutorial

The following steps will get you started with a very rudimentary example plugin for airshipctl. First, create a directory for your project outside of the GOPATH:

mkdir /tmp/example
cd /tmp/example

This project will need to be a go module. You can initialize a module named example with the following:

go mod init example

Note that modules are a relatively new feature added to Go, so you'll need to be running Go1.11 or greater. Also note that most modules will follow a naming schema that matches the remote version control system. A more realistice module name might look something like github.com/ian-howell/exampleplugin.

Next, create a file main.go and populate it with the following:

package main

import (
	"fmt"
	"os"

	"github.com/ian-howell/airshipctl/cmd"
	"github.com/spf13/cobra"
)

func main() {
	rootCmd, err := cmd.NewRootCmd(os.Stdout)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create root airshipctl command: %s\n", err.Error())
		os.Exit(1)
	}

	exampleCmd := &cobra.Command{
		Use:   "example",
		Short: "an example plugin",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Fprintln(os.Stdout, "Hello airshipctl!")
		},
	}

	rootCmd.AddCommand(exampleCmd)
	if err := rootCmd.Execute(); err != nil {
		fmt.Fprintf(os.Stderr, "Failure during execution: %s\n", err.Error())
		os.Exit(1)
	}
}

And finally, run the build command to download and compile airshipctl:

go build -o airshipctl

Now that you've built airshipctl, you can access your plugin with the following command:

./airshipctl example

For a more involved example, see the example plugin project