Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

native support for flags and arguments #4

Merged
merged 4 commits into from
Jan 7, 2019
Merged

Conversation

bobheadxi
Copy link
Contributor

native support for flags and arguments!

Arguments

	"admin": {
		Hidden:      true,
		Blurb:       "assign user as an admin",
		Description: "Assign an existing Temporal user as an administrator.",
		Args:        []string{"dbAdmin"},
		Action: func(cfg config.TemporalConfig, args map[string]string) {
			if args["dbAdmin"] == "" {
				fmt.Println("dbAdmin flag not provided")
				os.Exit(1)
			}
                         // ...

Flags

func baseFlagSet() *flag.FlagSet {
	var f = flag.NewFlagSet("", flag.ExitOnError)

	// basic flags
	devMode = f.Bool("dev", false,
		"toggle dev mode")
	configPath = f.String("config", os.Getenv("CONFIG_DAG"),
		"path to Temporal configuration")

	// db configuration
	dbNoSSL = f.Bool("db.no_ssl", false,
		"toggle SSL connection with database")
	dbMigrate = f.Bool("db.migrate", false,
		"toggle whether a database migration should occur")

	// grpc configuration
	grpcNoSSL = f.Bool("grpc.no_ssl", false,
		"toggle SSL connection with GRPC services")

	// api configuration
	apiPort = f.String("api.port", "6767",
		"set port to expose API on")

	return f
}
	temporal := cmd.New(commands, cmd.Config{
		Name:     "Temporal",
		ExecName: "temporal",
		Version:  Version,
		Desc:     "Temporal is an easy-to-use interface into distributed and decentralized storage technologies for personal and enterprise use cases.",
		Options:  baseFlagSet(),
	})

New Help Messages

Interact with Temporal's various queue APIs

USAGE:

  temporal [OPTIONS] queue [COMMAND]

COMMANDS:

  dfa         Database file add queue
  email-send  Email send queue
  ipfs        IPFS queue sub commands

OPTIONS:

  -api.port string
        set port to expose API on (default "6767")
  -config string
        path to Temporal configuration
  -db.migrate
        toggle whether a database migration should occur
  -db.no_ssl
        toggle SSL connection with database
  -dev
        toggle dev mode
  -grpc.no_ssl
        toggle SSL connection with GRPC services
Create a Temporal user. Provide args as username, password, email. Do not use in production.

USAGE:

  temporal [OPTIONS] user [user] [pass] [email]

OPTIONS:

  -api.port string
        set port to expose API on (default "6767")
  -config string
        path to Temporal configuration
  -db.migrate
        toggle whether a database migration should occur
  -db.no_ssl
        toggle SSL connection with database
  -dev
        toggle dev mode
  -grpc.no_ssl
        toggle SSL connection with GRPC services

@codecov
Copy link

codecov bot commented Jan 4, 2019

Codecov Report

Merging #4 into master will decrease coverage by 8.28%.
The diff coverage is 26.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #4      +/-   ##
==========================================
- Coverage   47.87%   39.58%   -8.29%     
==========================================
  Files           2        2              
  Lines          94      144      +50     
==========================================
+ Hits           45       57      +12     
- Misses         42       76      +34     
- Partials        7       11       +4
Impacted Files Coverage Δ
utils.go 26.74% <19.04%> (-1.56%) ⬇️
app.go 58.62% <42.85%> (-14.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19cbd2e...d673e45. Read the comment docs.

Copy link
Contributor

@bonedaddy bonedaddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!!!!!!!! 🎉

@bobheadxi bobheadxi merged commit d1a2e3f into master Jan 7, 2019
@bobheadxi bobheadxi deleted the flags-and-args branch January 7, 2019 20:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants