mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Make it VERY clear when nomulus shell is on PROD
We don't want people to accidentally run commands on prod thinking they were on Alpha / Sandbox. To do that - we add 2 safeguards: 1) when on prod, the shell has a strong RED "PRODUCTION" in the commandline, while on alpha/sandbox it's green. 2) if a prod shell is idle for > 1h, it exits. So don't accidentally use a prod shell from a long time ago. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=191931731
This commit is contained in:
parent
7bf0b059a6
commit
013558c814
3 changed files with 108 additions and 18 deletions
|
@ -104,10 +104,9 @@ final class RegistryCli implements AutoCloseable, CommandRunner {
|
|||
// Create the "help" and "shell" commands (these are special in that they don't have a default
|
||||
// constructor).
|
||||
jcommander.addCommand("help", new HelpCommand(jcommander));
|
||||
ShellCommand shellCommand = null;
|
||||
if (isFirstUse) {
|
||||
isFirstUse = false;
|
||||
shellCommand = new ShellCommand(this);
|
||||
ShellCommand shellCommand = new ShellCommand(this);
|
||||
// We have to build the completions based on the jcommander *before* we add the "shell"
|
||||
// command - to avoid completion for the "shell" command itself.
|
||||
shellCommand.buildCompletions(jcommander);
|
||||
|
@ -139,11 +138,6 @@ final class RegistryCli implements AutoCloseable, CommandRunner {
|
|||
checkState(RegistryToolEnvironment.get() == environment,
|
||||
"RegistryToolEnvironment argument pre-processing kludge failed.");
|
||||
|
||||
// We have to set the prompt here, because the environment wasn't set until this point
|
||||
if (shellCommand != null) {
|
||||
shellCommand.setPrompt(String.format("nom@%s > ", environment));
|
||||
}
|
||||
|
||||
// JCommander stores sub-commands as nested JCommander objects containing a list of user objects
|
||||
// to be populated. Extract the subcommand by getting the JCommander wrapper and then
|
||||
// retrieving the first (and, by virtue of our usage, only) object from it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue