Skip to content

Commit

Permalink
chore: add back content of getSfdxCliVersion() and getSfCliVersion()
Browse files Browse the repository at this point in the history
  • Loading branch information
daphne-sfdc committed Dec 2, 2023
1 parent 0221191 commit 1c77e46
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions packages/salesforcedx-utils/src/cli/checkCliVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

// import { CliCommandExecutor } from './cliCommandExecutor';
// import { CommandOutput } from './commandOutput';
// import { SfCommandBuilder } from './sfCommandBuilder';
// import { SfdxCommandBuilder } from './sfdxCommandBuilder';
import { CliCommandExecutor } from './cliCommandExecutor';
import { CommandOutput } from './commandOutput';
import { SfCommandBuilder } from './sfCommandBuilder';
import { SfdxCommandBuilder } from './sfdxCommandBuilder';

export enum CheckCliEnum {
validCli = 1,
Expand All @@ -20,11 +20,35 @@ export enum CheckCliEnum {

export class CheckCliVersion {
public async getSfdxCliVersion(): Promise<string> {
return 'result1';
try {
// Execute the command "sfdx --version" in the Terminal
const sfdxExecution = new CliCommandExecutor(
new SfdxCommandBuilder().withArg('--version').withJson().build(),
{}
).execute();
// Save the result of the command
const sfdxCmdOutput = new CommandOutput();
const sfdxVersion = await sfdxCmdOutput.getCmdResult(sfdxExecution);
return sfdxVersion;
} catch {
return 'No SFDX CLI';
}
}

public async getSfCliVersion(): Promise<string> {
return 'result2';
try {
// Execute the command "sf --version" in the Terminal
const sfExecution = new CliCommandExecutor(
new SfCommandBuilder().withArg('--version').withJson().build(),
{}
).execute();
// Save the result of the command
const sfCmdOutput = new CommandOutput();
const sfVersion = await sfCmdOutput.getCmdResult(sfExecution);
return sfVersion;
} catch {
return 'No SF CLI';
}
}

public async parseSfdxCliVersion(sfdxCliVersion: string): Promise<number[]> {
Expand Down

0 comments on commit 1c77e46

Please sign in to comment.