/cli

CLI used to create & build Flogo applications.

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Prerequisites

To get started with the Project Flogo cli you'll need

  • The Go programming language version 1.11 or later

Install the cli

To install the cli, simply open a terminal and enter the below command

$ go get -u github.com/project-flogo/cli/...

Note that the -u parameter automatically updates the cli if it exists

Commands

build

This command is used to build the application.

$ flogo build

options

-e, --embed         embed config
-h, --help          help for build
-o, --optimize      optimize build
      --shim string   trigger shim

create

This command is used to create a flogo application project.

Create the base sample project with a specific name

$ flogo create my_app

Create a flogo application project from an existing flogo application descriptor

$ flogo create -f myapp.json

options

-c, --core string   specify core library version [master| v0.0.1]
-f, --file string   path to flogo.json file

help

This commad shows help for any flogo commands.

$ flogo help build

install

This command is used to install a contribution to your project.

$ flogo install github.com/skothari-tibco/csvtimer

plugin

This command is used to install a plugin to your cli.

$ flogo plugin install github.com/skothari-tibco/walrus

$ flogo walrus

Global Flags

-- verbose verbose output

Creating a Flogo Cli Plugin.

  • To get started, create a sample cobra program.
  • Import the github.com/project-flogo/cli/common packages
  • Implement init() function to register to the flogo cli. You can also register subcommands.

Sample

package walrus

import (
	"fmt"
    "github.com/project-flogo/cli/common" //Import Flogo Cli 
	log "github.com/sirupsen/logrus"
	"github.com/spf13/cobra"
)

func GetWalrus() {
	log.WithFields(log.Fields{
		"animal": "walrus",
	}).Info("A walrus appears")
}

var helloCmd = &cobra.Command{
	Use:              "walrus",
	Short:            "says walrus",
	Long:             `This subcommand says walrus`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {}, // Add any functions you want to run before running the command. If not leave blank.
	Run: func(cmd *cobra.Command, args []string) {
        //Your Main Function
		GetWalrus()
	},
}

func init() {
	common.RegisterPlugin(helloCmd) // Register your main command

	helloCmd.AddCommand(sayCmd) // Register your sub commands
}

var sayCmd = &cobra.Command{
	Use:   "say",
	Short: "says walrus",
	Long:  `This subcommand says walrus`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("This is sub command")
	},
}
  • Host your Repo.
  • Install the plugin using following command:
$ flogo plugin install github.com/skothari-tibco/walrus