6 "github.com/u-root/u-root/pkg/core"
7 "github.com/u-root/u-root/pkg/core/cat"
8 "github.com/u-root/u-root/pkg/core/chmod"
9 "github.com/u-root/u-root/pkg/core/cp"
10 "github.com/u-root/u-root/pkg/core/find"
11 "github.com/u-root/u-root/pkg/core/ls"
12 "github.com/u-root/u-root/pkg/core/mkdir"
13 "github.com/u-root/u-root/pkg/core/mv"
14 "github.com/u-root/u-root/pkg/core/rm"
15 "github.com/u-root/u-root/pkg/core/touch"
16 "github.com/u-root/u-root/pkg/core/xargs"
17 "mvdan.cc/sh/v3/interp"
20var coreUtils = map[string]func() core.Command{
21 "cat": func() core.Command { return cat.New() },
22 "chmod": func() core.Command { return chmod.New() },
23 "cp": func() core.Command { return cp.New() },
24 "find": func() core.Command { return find.New() },
25 "ls": func() core.Command { return ls.New() },
26 "mkdir": func() core.Command { return mkdir.New() },
27 "mv": func() core.Command { return mv.New() },
28 "rm": func() core.Command { return rm.New() },
29 "touch": func() core.Command { return touch.New() },
30 "xargs": func() core.Command { return xargs.New() },
33func (s *Shell) coreUtilsHandler() func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc {
34 return func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc {
35 return func(ctx context.Context, args []string) error {
37 return next(ctx, args)
40 program, programArgs := args[0], args[1:]
42 newCoreUtil, ok := coreUtils[program]
44 return next(ctx, args)
47 c := interp.HandlerCtx(ctx)
50 cmd.SetIO(c.Stdin, c.Stdout, c.Stderr)
51 cmd.SetWorkingDir(c.Dir)
52 cmd.SetLookupEnv(func(key string) (string, bool) {
56 return cmd.RunContext(ctx, programArgs...)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list