-
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
Member
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. I agree, we can probably remove it as an example since it's Deno/ROSI specific as well. thought: In the future, we will probably introduce a The end result would be a universal log-level flag that works for all frameworks and ROSI. |
||||||||||||||||||||
| {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 | ||||||||||||||||||||
|
Member
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. nit: Could I suggest |
||||||||||||||||||||
| 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). | ||||||||||||||||||||
|
Member
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
|
||||||||||||||||||||
| 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-
Member
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. thought: Interesting idea to leave this to the framework. I think for now, we should leave this in the CLI. We can loosen it later if there is a feature request, but this starts with ensuring an error-free experience. If developers are running a build (e.g. |
||||||||||||||||||||
|
|
||||||||||||||||||||
| // 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, | ||||||||||||||||||||
|
Member
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. nit: You know my nit here, lol.
Suggested change
|
||||||||||||||||||||
| Auth: selection.Auth, | ||||||||||||||||||||
| Cleanup: runFlags.cleanup, | ||||||||||||||||||||
| ShowTriggers: triggers.ShowTriggers(clients, runFlags.hideTriggers), | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,7 +216,7 @@ The application's app-level token and bot access token will be provided as envir | |
|
|
||
| All Bolt SDKs leverage this `start` hook operating mode. | ||
|
|
||
| A custom start path can be set with the `SLACK_CLI_CUSTOM_FILE_PATH` variable. | ||
| A custom start path can be provided as a positional argument to the `run` command (e.g., `slack run ./src/app.py`), which sets both the `SLACK_APP_PATH` and `SLACK_CLI_CUSTOM_FILE_PATH` environment variables for the hook process. | ||
|
Member
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. praise: Thank you for updating this and choosing to support both at first. #backwards-compatible |
||
|
|
||
| ##### Output | ||
|
|
||
|
|
||
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...
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.
nit: I'd clarify that it's a filepath (
src/app.js) instead of a path (src/). Otherwise, I think it's clear!You could use
run [file-path]ifrun [app-file-path]reads strange to you.