Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
separate typiobj struct definition to separated file
Browse files Browse the repository at this point in the history
  • Loading branch information
imantung committed Oct 31, 2019
1 parent eafe803 commit 66dd31d
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 53 deletions.
11 changes: 11 additions & 0 deletions EXPERIMENTAL/typiobj/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import (
"go.uber.org/dig"
)

// CommandLiner responsible to give command
type CommandLiner interface {
CommandLine() cli.Command
}

// IsCommandLiner return true if object implementation of CommandLiner
func IsCommandLiner(obj interface{}) (ok bool) {
_, ok = obj.(CommandLiner)
return
}

// CliAction to return cli action
func CliAction(p interface{}, fn interface{}) func(ctx *cli.Context) error {
return func(ctx *cli.Context) (err error) {
Expand Down
12 changes: 0 additions & 12 deletions EXPERIMENTAL/typiobj/configuration.go

This file was deleted.

23 changes: 23 additions & 0 deletions EXPERIMENTAL/typiobj/configurer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package typiobj

// Configurer responsible to create config
type Configurer interface {
Configure() Configuration
}

// IsConfigurer return true if object implementation of configurer
func IsConfigurer(obj interface{}) (ok bool) {
_, ok = obj.(Configurer)
return
}

// Configuration represent the configuration
type Configuration struct {
Prefix string
Spec interface{}
}

// Configure return config itself
func (c Configuration) Configure() Configuration {
return c
}
12 changes: 0 additions & 12 deletions EXPERIMENTAL/typiobj/object.go → EXPERIMENTAL/typiobj/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,3 @@ func Description(obj interface{}) string {
// TODO:
return "<description>"
}

// IsCommandLiner return true if object implementation of CommandLiner
func IsCommandLiner(obj interface{}) (ok bool) {
_, ok = obj.(CommandLiner)
return
}

// IsConfigurer return true if object implementation of configurer
func IsConfigurer(obj interface{}) (ok bool) {
_, ok = obj.(Configurer)
return
}
9 changes: 9 additions & 0 deletions EXPERIMENTAL/typiobj/help.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package typiobj

// Help model
type Help struct {
// WIP:
Name string
Description string
// Configuration string
}
10 changes: 10 additions & 0 deletions EXPERIMENTAL/typiobj/runner.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package typiobj

import (
"go.uber.org/dig"
)

// Runner responsible to run the application
type Runner interface {
Run(c *dig.Container) error
}
29 changes: 0 additions & 29 deletions EXPERIMENTAL/typiobj/types.go

This file was deleted.

0 comments on commit 66dd31d

Please sign in to comment.