1515package env
1616
1717import (
18+ "context"
1819 "strings"
1920
2021 "github.com/slackapi/slack-cli/internal/prompts"
@@ -34,28 +35,30 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command {
3435 cmd := & cobra.Command {
3536 Use : "env <subcommand>" ,
3637 Aliases : []string {"var" , "vars" , "variable" , "variables" },
37- Short : "Add, remove , or list environment variables" ,
38+ Short : "Set, unset , or list environment variables" ,
3839 Long : strings .Join ([]string {
39- "Add, remove, or list environment variables for apps deployed to Slack managed" ,
40- "infrastructure." ,
40+ "Set, unset, or list environment variables for the project." ,
4141 "" ,
42- "This command is supported for apps deployed to Slack managed infrastructure but" ,
43- "other apps can attempt to run the command with the --force flag." ,
42+ "Commands that run in the context of a project source environment variables from" ,
43+ "the \" .env\" file. This includes the \" run\" command." ,
44+ "" ,
45+ "The \" deploy\" command gathers environment variables from the \" .env\" file as well" ,
46+ "unless the app is using ROSI features." ,
4447 "" ,
4548 `Explore more: {{LinkText "https://docs.slack.dev/tools/slack-cli/guides/using-environment-variables-with-the-slack-cli"}}` ,
4649 }, "\n " ),
4750 Example : style .ExampleCommandsf ([]style.ExampleCommand {
4851 {
49- Meaning : "Add an environment variable" ,
50- Command : "env add MAGIC_PASSWORD abracadbra" ,
52+ Meaning : "Set an environment variable" ,
53+ Command : "env set MAGIC_PASSWORD abracadbra" ,
5154 },
5255 {
5356 Meaning : "List all environment variables" ,
5457 Command : "env list" ,
5558 },
5659 {
57- Meaning : "Remove an environment variable" ,
58- Command : "env remove MAGIC_PASSWORD" ,
60+ Meaning : "Unset an environment variable" ,
61+ Command : "env unset MAGIC_PASSWORD" ,
5962 },
6063 }),
6164 RunE : func (cmd * cobra.Command , args []string ) error {
@@ -64,9 +67,22 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command {
6467 }
6568
6669 // Add child commands
67- cmd .AddCommand (NewEnvAddCommand (clients ))
70+ cmd .AddCommand (NewEnvSetCommand (clients ))
6871 cmd .AddCommand (NewEnvListCommand (clients ))
69- cmd .AddCommand (NewEnvRemoveCommand (clients ))
72+ cmd .AddCommand (NewEnvUnsetCommand (clients ))
7073
7174 return cmd
7275}
76+
77+ // isHostedRuntime returns true if the local manifest is for an app that uses
78+ // the Deno Slack SDK function runtime.
79+ //
80+ // It defaults to false when the manifest cannot be fetched, which directs the
81+ // command to use the project ".env" file. Otherwise the API is used.
82+ func isHostedRuntime (ctx context.Context , clients * shared.ClientFactory ) bool {
83+ manifest , err := clients .AppClient ().Manifest .GetManifestLocal (ctx , clients .SDKConfig , clients .HookExecutor )
84+ if err != nil {
85+ return false
86+ }
87+ return manifest .IsFunctionRuntimeSlackHosted () || manifest .IsFunctionRuntimeLocal ()
88+ }
0 commit comments