kiyonlin / dawn

An opinionated lightweight framework to build web api or application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸš€ Add dawn-cli

kiyonlin opened this issue Β· comments

commented

Describe the solution you'd like
Add dawn command line interface based on cli cobra.

Additional context

commented

LOGO: dawn on the ocean

       __
   ___/ /__ __    _____
 ~/ _  / _ '/ |/|/ / _ \~
~~\_,_/\_,_/|__,__/_//_/~~
 ~~~  ~~ ~~~~~~~~~ ~~~~~~

Special thanks to patorjk.com.

commented

dawn-cli v0.0.1

       __
   ___/ /__ __    _____    dawn-cli v0.0.1
 ~/ _  / _ '/ |/|/ / _ \~  For the opinionated lightweight framework dawn
~~\_,_/\_,_/|__,__/_//_/~~ Visit https://github.com/kiyonlin/dawn for detail
 ~~~  ~~ ~~~~~~~~~ ~~~~~~  (c) since 2020 by kiyonlin@163.com

USAGE:
   dawn [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print dawn version (default: false)
commented

Add new command

       __
   ___/ /__ __    _____    dawn-cli v0.0.1
 ~/ _  / _ '/ |/|/ / _ \~  For the opinionated lightweight framework dawn
~~\_,_/\_,_/|__,__/_//_/~~ Visit https://github.com/kiyonlin/dawn for detail
 ~~~  ~~ ~~~~~~~~~ ~~~~~~  (c) since 2020 by kiyonlin@163.com

USAGE:
   dawn [global options] command [command options] [arguments...]

COMMANDS:
   new, n   Generate a new dawn project
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print dawn version (default: false)

dawn new --help

NAME:
   dawn new - Generate a new dawn project

USAGE:
   new [options] project [mod name]

OPTIONS:
   --app       create an application project (default: false)
   --help, -h  show help (default: false)

dawn new dawn-demo

go: creating new go.mod: module dawn-demo
go: finding module for package github.com/kiyonlin/dawn/fiberx
go: finding module for package github.com/gofiber/fiber/v2
go: finding module for package github.com/kiyonlin/dawn
go: found github.com/gofiber/fiber/v2 in github.com/gofiber/fiber/v2 v2.0.4
go: found github.com/kiyonlin/dawn in github.com/kiyonlin/dawn v0.3.0

Scaffolding project in /path/to/pwd/dawn-demo (module dawn-demo)

  Done. Now run:

  cd dawn-demo
  go run .

✨  Done in 3.130166283s.
commented

dawn -v

dawn version: v0.3.0(latest v0.3.0)
dawn version: open go.mod: no such file or directory(latest v0.3.0)
commented

v0.0.2 with dawn module

       __
   ___/ /__ __    _____    dawn-cli v0.0.2
 ~/ _  / _ '/ |/|/ / _ \~  For the opinionated lightweight framework dawn
~~\_,_/\_,_/|__,__/_//_/~~ Visit https://github.com/kiyonlin/dawn for detail
 ~~~  ~~ ~~~~~~~~~ ~~~~~~  (c) since 2020 by kiyonlin@163.com

USAGE:
   dawn [global options] command [command options] [arguments...]

COMMANDS:
   new, n     Generate a new dawn project
   module, m  Generate a new dawn module
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print dawn version (default: false)

dawn help module

NAME:
   dawn module - Generate a new dawn module

USAGE:
   dawn module name

dawn module hello

Scaffolding module in /path/to/pwd/dawn-demo/hello

  Done. Now run:

  cd hello
  go test . -cover

🎊  Done in 563.455¡s.
commented

dawn dev is inspired by air.

Use fsnotify to watch files and rerun the dawn project.

Options will be:

  • root: Path to be watched, default value is .
  • path: Dev invokes go build path, default value is .
  • extensions: File extensions to watch, default value is go,tmpl,tpl,html
  • exclude_dir: Ignore these directories, default value is assets,tmp,vendor,node_modules
  • exclude_file: Ignore these files, default is ""
  • delay: It's not necessary to trigger rerun each time file changes if it's too frequent, default value is 1s
commented

v0.0.3 with dawn dev

       __
   ___/ /__ __    _____    dawn-cli v0.0.3
 ~/ _  / _ '/ |/|/ / _ \~  For the opinionated lightweight framework dawn
~~\_,_/\_,_/|__,__/_//_/~~ Visit https://github.com/kiyonlin/dawn for detail
 ~~~  ~~ ~~~~~~~~~ ~~~~~~  (c) since 2020 by kiyon@gofiber.io

USAGE:
   dawn [global options] command [command options] [arguments...]

COMMANDS:
   new, n     Generate a new dawn project
   module, m  Generate a new dawn module
   dev        Rerun the dawn project if watched files change
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print dawn version (default: false)

dawn help dev

NAME:
   dawn dev - Rerun the dawn project if watched files change

USAGE:
   dawn dev [options]

OPTIONS:
   --root value, -r value             root path for watch, all files must be under root (default: ".")
   --target value, -t value           target path for go build (default: ".")
   --extensions value, --ext value    file extensions to watch (default: "go", "tmpl", "tpl", "html")
   --exclude_dirs value, --ed value   ignore these directories (default: "assets", "tmp", "vendor", "node_modules")
   --exclude_files value, --ef value  ignore these files
   --delay value, -d value            delay to trigger rerun (default: 1s)

dawn dev

2020/10/10 08:37:58 Welcome to dawn dev πŸ‘‹
2020/10/10 08:38:00 Compile done!
2020/10/10 08:38:00 New pid is 62012

 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚                    Fiber v2.0.6                   β”‚
 β”‚               http://127.0.0.1:3000               β”‚
 β”‚                                                   β”‚
 β”‚ Handlers ............. 5  Threads ............. 8 β”‚
 β”‚ Prefork ....... Disabled  PID ............. 62012 β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

^C2020/10/10 08:38:06 See you next time πŸ‘‹
commented

v0.0.7 with cobra and dawn generate

       __
   ___/ /__ __    _____    dawn-cli v0.0.7
 ~/ _  / _ '/ |/|/ / _ \~  For the opinionated lightweight framework dawn
~~\_,_/\_,_/|__,__/_//_/~~ Visit https://github.com/kiyonlin/dawn for detail
 ~~~  ~~ ~~~~~~~~~ ~~~~~~  (c) since 2020 by kiyon@gofiber.io

Usage:
  dawn [flags]
  dawn [command]

Available Commands:
  dev         Rerun the dawn project if watched files changed
  generate    Generate boilerplate code with different commands
  help        Help about any command
  new         Generate a new dawn project
  version     Print the version number of dawn

Flags:
  -h, --help   help for dawn

Use "dawn [command] --help" for more information about a command.

dawn help generate

Generate boilerplate code with different commands

Usage:
  dawn generate [flags]
  dawn generate [command]

Aliases:
  generate, g

Available Commands:
  module      Generate a new dawn module

Flags:
  -h, --help   help for generate

Use "dawn generate [command] --help" for more information about a command.