diff options
| author | ewy <ewy0@protonmail.com> | 2026-05-02 18:28:40 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-05-02 18:28:40 +0200 |
| commit | e8b9ca135642c76000bc0ec2e78674c602a748dd (patch) | |
| tree | 4e502ce767a4a4f70e40d6e72a3817bc139f1300 /main.go | |
| parent | 35e6ac334f6a62cf63b743182cd5355f6baf4406 (diff) | |
add .js and .ts support
also: remove unused/duplicate method runner.Hydrate
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -14,6 +14,7 @@ import ( "github.com/ewy1/pik/run" "github.com/ewy1/pik/runner/exc" "github.com/ewy1/pik/runner/gnumake" + "github.com/ewy1/pik/runner/js" "github.com/ewy1/pik/runner/just" "github.com/ewy1/pik/runner/python" "github.com/ewy1/pik/runner/shell" @@ -36,6 +37,7 @@ var initializers = ComponentList[model.Initializer]{ pikdex.Indexer, python.Python, git.Git, + js.Js, } // indexers are methods which scan a directory and return a number of targets. @@ -43,6 +45,7 @@ var indexers = ComponentList[model.Indexer]{ pikdex.Indexer, just.Indexer, gnumake.Indexer, + js.Js, } // runners are modules which know how to turn a file into an exec.Cmd @@ -51,6 +54,7 @@ var runners = ComponentList[model.Runner]{ shell.Runner, python.Python, exc.Exc, + js.Js, } // hydrators are ran when the menu is required @@ -131,13 +135,16 @@ func main() { args := pflag.Args() var result *search.Result + cancelled := false if len(args) == 0 { - source, target, err := menu.Show(st, hydrators) + md, err := menu.Show(st, hydrators) if err != nil { _, _ = spool.Warn("%v\n", err) os.Exit(1) } + cancelled = md.Cancel + source, target := md.Result() if target != nil { t := target.Target() result = &search.Result{ @@ -166,6 +173,12 @@ func main() { return } + if cancelled { + _, _ = spool.Warn("no target selected\n") + os.Exit(0) + return + } + if result.Target == nil { _, _ = spool.Warn("target not found\n") os.Exit(1) |
