-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Roy Razon
committed
Apr 3, 2024
1 parent
9cbcaaa
commit 447d80f
Showing
2 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ux } from '@oclif/core' | ||
import { findEnvId } from '@preevy/core' | ||
import ProfileCommand from '../profile-command.js' | ||
import { envIdFlags } from '../common-flags.js' | ||
|
||
// eslint-disable-next-line no-use-before-define | ||
export default class EnvId extends ProfileCommand<typeof EnvId> { | ||
static description = 'Show the Preevy environment ID for the current Compose project' | ||
|
||
static flags = { | ||
...envIdFlags, | ||
} | ||
|
||
static enableJsonFlag = true | ||
|
||
static args = {} | ||
|
||
async run(): Promise<unknown> { | ||
const log = this.logger | ||
const { flags, args } = this | ||
|
||
const envId = await findEnvId({ | ||
userSpecifiedEnvId: flags.id, | ||
userSpecifiedProjectName: flags.project, | ||
userModel: () => this.ensureUserModel(), | ||
log, | ||
explanationLogLevel: 'debug', | ||
}) | ||
|
||
if (this.jsonEnabled()) { | ||
return envId | ||
} | ||
|
||
ux.log(envId) | ||
return undefined | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters