-
Notifications
You must be signed in to change notification settings - Fork 31
feat: add optional filepath argument to run command #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: zimeg-fix-env-quote
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -47,13 +47,14 @@ var runAppSelectPromptFunc = prompts.AppSelectPrompt | |||||||||||||||||||
|
|
||||||||||||||||||||
| func NewRunCommand(clients *shared.ClientFactory) *cobra.Command { | ||||||||||||||||||||
| cmd := &cobra.Command{ | ||||||||||||||||||||
| Use: "run", | ||||||||||||||||||||
| Use: "run [app-path]", | ||||||||||||||||||||
| Aliases: []string{"dev", "start-dev"}, // Aliases a few proposed alternative names | ||||||||||||||||||||
| Short: "Start a local server to develop and run the app locally", | ||||||||||||||||||||
| Long: `Start a local server to develop and run the app locally while watching for file changes`, | ||||||||||||||||||||
| Args: cobra.MaximumNArgs(1), | ||||||||||||||||||||
| Example: style.ExampleCommandsf([]style.ExampleCommand{ | ||||||||||||||||||||
| {Command: "platform run", Meaning: "Start a local development server"}, | ||||||||||||||||||||
| {Command: "platform run --activity-level debug", Meaning: "Run a local development server with debug activity"}, | ||||||||||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗣️ note: IIRC this activity level flag isn't used often so we might encourage examples that outline another common use case?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👾 ramble: I'm now curious if this flag updates a |
||||||||||||||||||||
| {Command: "platform run ./src/app.py", Meaning: "Run a local development server with a custom app entry point"}, | ||||||||||||||||||||
| {Command: "platform run --cleanup", Meaning: "Run a local development server with cleanup"}, | ||||||||||||||||||||
| }), | ||||||||||||||||||||
| PreRunE: func(cmd *cobra.Command, args []string) error { | ||||||||||||||||||||
|
|
@@ -96,6 +97,16 @@ func RunRunCommand(clients *shared.ClientFactory, cmd *cobra.Command, args []str | |||||||||||||||||||
| } | ||||||||||||||||||||
| ctx := cmd.Context() | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var appPath string | ||||||||||||||||||||
| if len(args) > 0 { | ||||||||||||||||||||
| appPath = args[0] | ||||||||||||||||||||
| if _, err := clients.Fs.Stat(appPath); err != nil { | ||||||||||||||||||||
| return slackerror.New(slackerror.ErrNotFound). | ||||||||||||||||||||
| WithMessage("The app path %q could not be found", appPath). | ||||||||||||||||||||
| WithRemediation("Check that the file exists and the path is correct") | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+100
to
+108
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🪓 note: I'm curious of removing this in favor of leaving errors to the hook implementations. Removing this might let for strange argument parsing as perhaps: 👾 ramble: For now it seems to make a better experience for the intended filepath arguments I think- |
||||||||||||||||||||
|
|
||||||||||||||||||||
| // Get the workspace from the flag or prompt | ||||||||||||||||||||
| selection, err := runAppSelectPromptFunc(ctx, clients, prompts.ShowLocalOnly, prompts.ShowAllApps) | ||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||
|
|
@@ -136,6 +147,7 @@ func RunRunCommand(clients *shared.ClientFactory, cmd *cobra.Command, args []str | |||||||||||||||||||
| Activity: !runFlags.noActivity, | ||||||||||||||||||||
| ActivityLevel: runFlags.activityLevel, | ||||||||||||||||||||
| App: selection.App, | ||||||||||||||||||||
| AppPath: appPath, | ||||||||||||||||||||
| Auth: selection.Auth, | ||||||||||||||||||||
| Cleanup: runFlags.cleanup, | ||||||||||||||||||||
| ShowTriggers: triggers.ShowTriggers(clients, runFlags.hideTriggers), | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📚 note: I'm not so excited about this placeholder but it's clear to me...