Skip to content

Commit 2425646

Browse files
committed
feat: improve update command output to be less verbose
- Remove redundant 'Updating via...' messages from update functions - Streamline main update function to show version transition in one line - Simplify success messages to be more concise - Maintain all interactive functionality and error handling - Keep essential information while reducing noise Output now shows: 'Updating from 0.16.0 to 8.3.0...' 'Updated to latest version via npm!' Instead of multiple verbose step-by-step messages for each operation. The interactive prompts and functionality remain unchanged.
1 parent 02c515a commit 2425646

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/SDK/Language/CLI.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ public function getFiles(): array
330330
'scope' => 'default',
331331
'destination' => 'lib/commands/types.js',
332332
'template' => 'cli/lib/commands/types.js.twig',
333+
],
334+
[
335+
'scope' => 'default',
336+
'destination' => 'lib/commands/update.js',
337+
'template' => 'cli/lib/commands/update.js.twig',
333338
]
334339
];
335340
}

templates/cli/lib/commands/update.js.twig

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ const execCommand = (command, args = [], options = {}) => {
105105
* Update via npm
106106
*/
107107
const updateViaNpm = async () => {
108-
log("Updating via npm...");
109108
try {
110109
await execCommand('npm', ['install', '-g', '{{ language.params.npmPackage|caseDash }}@latest']);
111-
success("Successfully updated {{ language.params.executableName|caseLower }} via npm!");
110+
success("Updated to latest version via npm!");
112111
hint("Run '{{ language.params.executableName|caseLower }} --version' to verify the new version.");
113112
} catch (e) {
114113
error(`Failed to update via npm: ${e.message}`);
@@ -120,10 +119,9 @@ const updateViaNpm = async () => {
120119
* Update via Homebrew
121120
*/
122121
const updateViaHomebrew = async () => {
123-
log("Updating via Homebrew...");
124122
try {
125123
await execCommand('brew', ['upgrade', '{{ language.params.executableName|caseLower }}']);
126-
success("Successfully updated {{ language.params.executableName|caseLower }} via Homebrew!");
124+
success("Updated to latest version via Homebrew!");
127125
hint("Run '{{ language.params.executableName|caseLower }} --version' to verify the new version.");
128126
} catch (e) {
129127
error(`Failed to update via Homebrew: ${e.message}`);
@@ -135,7 +133,6 @@ const updateViaHomebrew = async () => {
135133
* Update via installation script
136134
*/
137135
const updateViaScript = async () => {
138-
log("Updating via installation script...");
139136
const platform = os.platform();
140137

141138
try {
@@ -146,7 +143,7 @@ const updateViaScript = async () => {
146143
// Linux/macOS bash script
147144
await execCommand('sh', ['-c', 'wget -q https://appwrite.io/cli/install.sh -O - | /bin/bash']);
148145
}
149-
success("Successfully updated {{ language.params.executableName|caseLower }} via installation script!");
146+
success("Updated to latest version via installation script!");
150147
hint("Run '{{ language.params.executableName|caseLower }} --version' to verify the new version.");
151148
} catch (e) {
152149
error(`Failed to update via installation script: ${e.message}`);
@@ -190,10 +187,7 @@ const showManualInstructions = (latestVersion) => {
190187
* Main update function
191188
*/
192189
const updateCli = async ({ manual } = {}) => {
193-
log(`Current version: ${chalk.bold(version)}`);
194-
195190
try {
196-
log("Checking for updates...");
197191
const latestVersion = await getLatestVersion();
198192

199193
const comparison = compareVersions(version, latestVersion);
@@ -207,8 +201,7 @@ const updateCli = async ({ manual } = {}) => {
207201
return;
208202
}
209203

210-
log(`Latest version: ${chalk.bold(latestVersion)}`);
211-
log(`${chalk.green('→')} A new version is available!`);
204+
log(`Updating from ${chalk.blue(version)} to ${chalk.green(latestVersion)}...`);
212205
console.log("");
213206

214207
if (manual) {

0 commit comments

Comments
 (0)