Skip to content

Commit

Permalink
Merge pull request oclif#22 from sumwatshade/fix/install
Browse files Browse the repository at this point in the history
fix: add success msg + fix tar ext
  • Loading branch information
sumwatshade authored Jun 16, 2021
2 parents 95c7c62 + e7c5729 commit 8d867fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ export default class InstallCommand extends UpdateCommand {
.filter((dirOrFile) => dirOrFile !== 'bin' && dirOrFile !== 'current');

if (versions.includes(targetVersion)) {
this.log(
`Found ${targetVersion} installed locally. Attempting to switch to ${targetVersion} now.`,
);

await this.updateToExistingVersion(targetVersion);
this.currentVersion = await this.determineCurrentVersion();
this.updatedVersion = targetVersion;
if (channelUpdateRequested) {
await this.setChannel();
}
this.log(`Success! You are now on ${targetVersion}!`);
} else {
const explicitVersion = isExplicitVersion ? targetVersion : null;
cli.action.start(`${this.config.name}: Updating CLI`);
Expand All @@ -67,7 +72,9 @@ export default class InstallCommand extends UpdateCommand {
this.debug('tidy');
await this.tidy();
await this.config.runHook('update', { channel: this.channel });

this.log(
`Success! Installed ${targetVersion}. You are now on ${targetVersion}!`,
);
this.debug('done');
cli.action.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default class UpdateCommand extends Command {
bin: this.config.bin,
platform: this.config.platform,
arch: this.config.arch,
ext: targetVersion ? 'tar.gz' : 'gz',
ext: targetVersion ? '.tar.gz' : 'gz',
}),
);
const { response: stream } = await http.stream(gzUrl);
Expand Down

0 comments on commit 8d867fd

Please sign in to comment.