MCPcopy Index your code
hub / github.com/dagger/dagger / RunAll

Method RunAll

cmd/dagger/shell.go:163–193  ·  view source on GitHub ↗

RunAll is the entry point for the shell command It creates the runner and dispatches the execution to different modes: - Interactive: when no arguments are provided - File: when a file path is provided as an argument - Code: when code is passed inline using the `-c,--code` flag or via stdin

(ctx context.Context, args []string)

Source from the content-addressed store, hash-verified

161// - File: when a file path is provided as an argument
162// - Code: when code is passed inline using the `-c,--code` flag or via stdin
163func (h *shellCallHandler) RunAll(ctx context.Context, args []string) error {
164 h.tty = !silent && (hasTTY && progress == "auto" || progress == "tty")
165
166 if err := h.Initialize(ctx); err != nil {
167 return err
168 }
169
170 // Example: `dagger shell -c 'container | workdir'`
171 if shellCode != "" {
172 return h.run(ctx, strings.NewReader(shellCode), "")
173 }
174
175 // Use stdin only when no file paths are provided
176 if len(args) == 0 {
177 // Example: `dagger shell`
178 if isatty.IsTerminal(os.Stdin.Fd()) {
179 return h.runInteractive(ctx)
180 }
181 // Example: `echo 'container | workdir' | dagger shell`
182 return h.run(ctx, os.Stdin, "-")
183 }
184
185 // Example: `dagger shell job1.dsh job2.dsh`
186 for _, path := range args {
187 if err := h.runPath(ctx, path); err != nil {
188 return err
189 }
190 }
191
192 return nil
193}
194
195func (h *shellCallHandler) Initialize(ctx context.Context) error {
196 r, err := interp.New(

Callers 2

TestShellAutocompleteMethod · 0.80
shell.goFile · 0.80

Calls 4

InitializeMethod · 0.95
runMethod · 0.95
runInteractiveMethod · 0.95
runPathMethod · 0.95

Tested by 1

TestShellAutocompleteMethod · 0.64