Giter Site home page Giter Site logo

hofstadter-io / hofmod-cli Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 2.0 136 KB

Hofstadter generator for Golang CLIs

Home Page: https://github.com/hofstadter-io/hof

License: BSD 3-Clause "New" or "Revised" License

Go 71.57% CUE 25.83% Makefile 2.60%
cue cuelang hof-lang hof cli golang dsl code-generator

hofmod-cli's Issues

always generates update and version subcommands

I'm explicitly setting the schema fields to false:

#CLI: schema.#Cli & {
	Name: "test"
	Package: "example.com/test/test/cmd/test"
	Short: "a test"

	CompletionCommands: false
	Updates: false
	
    OmitRun: false

	Pflags: [...schema.#Flag] & [{
		Name: "test"
		Long: "test"
		Short: "t"
		Type: "string"
		Default: ""
		Help: "test test test"
	}]

	// Commands: []
}

and while they are not added to the Cmd in root.go the actual commands still get generated:

cmd/test
├── cmd
│  ├── completions.go
│  ├── hls
│  │  └── cli
│  │     └── root
│  │        └── help.hls
│  ├── root.go
│  ├── root_test.go
│  ├── update.go
│  └── version.go
├── flags
│  └── root.go
├── main.go
└── verinfo
   └── verinfo.go

which makes the build fail like this:

building go files...
go build -o test ./cmd/test
go: finding module for package example.com/test/test/cmd/test/ga
cmd/test/cmd/completions.go:8:2: cannot find module providing package example.com/test/test/cmd/test/ga: module example.com/test/test/cmd/test/ga: git ls-remote -q origin in /home/user/go/pkg/mod/cache/vcs/BLAAAAAAAAAA: exit status 128:
	ERROR: Repository not found.
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.
make: *** [Makefile:10: build] Error 1

Manage multiple versions of the same application

  • install versions with suffix
  • copy current to suffixless
  • ? create a place to install all "vendor" tools

(vendor here means we should start adding a level of hierarchy for vendor/company -> tools / projects / configs / etc)

FlagPole updates

  • Docs strings, default to help & flag default
  • DeaultFlagPole func for when not using via CLI

Version command

add a default included version command that integrates with goreleaser variables

generated "rest" args will panic when the extra arg is not present

This below was generated from, not sure why the rest is there? I think we use it to pass remaining args to the template, but where is the config? Did I put this in manually?

#CreateCommand: schema.#Command & {
	Name:  "create"
	Usage: "create <module location>"
	Short: "dynamic blueprints from any git repo"
	Long:  #CreateRootHelp

	Args: [{
		Name: "module"
		Type: "string"
		Required: false
		Help: "git repository or directory with a creator, accepts subdirs on both"
	}]

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		// Argument Parsing

		var module string

		if 0 < len(args) {

			module = args[0]

		}

		err = CreateRun(module, args[1:])
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},

Make feedback work

  • implement feedback command
  • sending options
    • email
    • api
    • services?
  • capturing recent commands?
  • run editor are accept file as input

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.