refactor: rename console to gconsole
This commit is contained in:
parent
29e12c1aa6
commit
d953b99b62
@ -5,7 +5,7 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -5,7 +5,7 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import (
|
||||
"flag"
|
@ -5,7 +5,7 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import "flag"
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import (
|
||||
"errors"
|
@ -5,7 +5,7 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import (
|
||||
"errors"
|
@ -5,7 +5,7 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import "fmt"
|
||||
|
@ -5,14 +5,14 @@
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package console
|
||||
package gconsole
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
type ConsoleApp struct {
|
||||
type App struct {
|
||||
name string
|
||||
version string
|
||||
desc string
|
||||
@ -20,8 +20,8 @@ type ConsoleApp struct {
|
||||
about ActionHandler
|
||||
}
|
||||
|
||||
func New(name, desc string) *ConsoleApp {
|
||||
app := &ConsoleApp{
|
||||
func New(name, desc string) *App {
|
||||
app := &App{
|
||||
name: name,
|
||||
version: "v0.1.0",
|
||||
desc: desc,
|
||||
@ -35,40 +35,40 @@ func New(name, desc string) *ConsoleApp {
|
||||
return app
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) GetCmds() map[string]ICommand {
|
||||
func (s *App) GetCmds() map[string]ICommand {
|
||||
return s.cmds
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) GetName() string {
|
||||
func (s *App) GetName() string {
|
||||
return s.name
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) GetDesc() string {
|
||||
func (s *App) GetDesc() string {
|
||||
return s.desc
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) GetVersion() string {
|
||||
func (s *App) GetVersion() string {
|
||||
return s.version
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) AddCmd(cmd ICommand) {
|
||||
func (s *App) AddCmd(cmd ICommand) {
|
||||
s.cmds[cmd.GetName()] = cmd
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) HasCmd(cmd string) bool {
|
||||
func (s *App) HasCmd(cmd string) bool {
|
||||
_, ok := s.cmds[cmd]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) SetExtraAbout(about ActionHandler) {
|
||||
func (s *App) SetExtraAbout(about ActionHandler) {
|
||||
s.about = about
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) GetExtraAbout() ActionHandler {
|
||||
func (s *App) GetExtraAbout() ActionHandler {
|
||||
return s.about
|
||||
}
|
||||
|
||||
func (s *ConsoleApp) Run(args []string) {
|
||||
func (s *App) Run(args []string) {
|
||||
cmd := "list"
|
||||
if len(args) == 1 {
|
||||
args = []string{cmd}
|
Loading…
Reference in New Issue
Block a user