Skip to content

Commit

Permalink
update litecmd.go
Browse files Browse the repository at this point in the history
  • Loading branch information
hedzr committed Nov 1, 2024
1 parent 2007383 commit b13d013
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tiny/litecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,25 @@ import (
"github.com/hedzr/store"
)

// onEvalJumpSubCommands querys shell scripts in EXT directory
// (typically it is `/usr/local/lib/<app-name>/ext/`) and build
// as subcommands dynamically.
//
// In this demo app, we looks up `./ci/pkg/usr.local.lib.large-app/ext`
// with hard-code.
//
// EXT directory: see the [cmdr.UsrLibDir()] for its location.
func onEvalJumpSubCommands(ctx context.Context, c cli.Cmd) (it cli.EvalIterator, err error) {
files := make(map[string]*liteCmdS)
pos := 0
var keys []string

baseDir := path.Join("ci", "pkg", "usr.local.lib.tiny-app", "ext")
baseDir := cmdr.UsrLibDir()
if !dir.FileExists(baseDir) {
baseDir = path.Join("ci", "pkg", "usr.local.lib", c.App().Name(), "ext")
} else {
baseDir = path.Join(baseDir, "ext")
}
err = dir.ForFile(baseDir, func(depth int, dirName string, fi os.DirEntry) (stop bool, err error) {
if fi.Name()[0] == '.' {
return
Expand Down

0 comments on commit b13d013

Please sign in to comment.