|
39 | 39 | ->task('setEndpoint') |
40 | 40 | ->param('endpoint', '', new Mock(), 'Your {{ spec.title | title }} endpoint', false) |
41 | 41 | ->action(function($endpoint) use ($client) { |
42 | | - $client->setPreference('endpoint', $endpoint); |
43 | | - $result = $client->savePreferences(); |
| 42 | + $result = $client->setPreference('endpoint', $endpoint) |
| 43 | + ->savePreferences(); |
| 44 | + if ($result === false) { |
| 45 | + Console::error('❌ Could not save preferences.'); |
| 46 | + } else { |
| 47 | + Console::success('✅ Preferences saved successfully'); |
| 48 | + } |
| 49 | + }); |
| 50 | +
|
| 51 | +$cli |
| 52 | + ->task('setSelfSigned') |
| 53 | + ->param('value', '', new Mock(), 'A boolean representing whether you are using a self signed certificate', false) |
| 54 | + ->action(function($value) use ($client) { |
| 55 | + $result = $client->setPreference('selfSigned', $value) |
| 56 | + ->savePreferences(); |
44 | 57 | if ($result === false) { |
45 | 58 | Console::error('❌ Could not save preferences.'); |
46 | 59 | } else { |
|
54 | 67 | ->task('set{{ header.key }}') |
55 | 68 | ->param('{{ header.key | lower }}', '', new Mock(), '{{ header.description }}', false) |
56 | 69 | ->action(function(${{ header.key | lower }}) use ($client) { |
57 | | - $client->setPreference('{{ header.name }}', ${{ header.key | lower }}); |
58 | | - $result = $client->savePreferences(); |
| 70 | + $result = $client->setPreference('{{ header.name }}', ${{ header.key | lower }}) |
| 71 | + ->savePreferences(); |
59 | 72 | if ($result === false) { |
60 | 73 | Console::error('❌ Could not save preferences.'); |
61 | 74 | } else { |
|
83 | 96 | "setEndpoint" => "Set your server endpoint.", |
84 | 97 | "setProject" => "Set the project you want to connect to.", |
85 | 98 | "setKey" => "Set the API key for the project.", |
86 | | - "setLocale" => "Set your preferred locale (eg: en-US)." |
| 99 | + "setLocale" => "Set your preferred locale (eg: en-US).", |
| 100 | + "setSelfSigned" => "Set whether you are using a self signed certificate", |
| 101 | + "version" => "Get the current cli version" |
87 | 102 | ]; |
88 | 103 | $parser->formatArray($commands); |
89 | 104 | Console::log("\nRun '{{ language.params.executableName }} client COMMAND --help' for more information on a command."); |
|
0 commit comments