Add --no-input to all commands - #8407
Draft
gonzaloriestra wants to merge 2 commits into
Draft
Conversation
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationspackages/cli-kit/dist/public/node/no-input.d.tsexport declare const noInputFlag: {
'no-input': import("@oclif/core/interfaces").BooleanFlag<boolean>;
};
Existing type declarationspackages/cli-kit/dist/public/node/base-command.d.ts@@ -1,5 +1,5 @@
import { Command } from '@oclif/core';
-import { OutputFlags, Input, ParserOutput, FlagInput, OutputArgs } from '@oclif/core/parser';
+import { OutputFlags, Input, ParserOutput, OutputArgs } from '@oclif/core/parser';
export type ArgOutput = OutputArgs<any>;
export type FlagOutput = OutputFlags<any>;
export interface NonTTYFlagRequirement {
@@ -9,7 +9,9 @@ export interface NonTTYFlagRequirement {
when?: (flags: FlagOutput) => boolean;
}
declare abstract class BaseCommand extends Command {
- static baseFlags: FlagInput<{}>;
+ static baseFlags: {
+ 'no-input': import("@oclif/core/interfaces").BooleanFlag<boolean>;
+ };
static get requiresSyncAnalytics(): boolean;
static nonTTYFlagRequirements(_flags: FlagOutput): NonTTYFlagRequirement[];
static descriptionWithoutMarkdown(): string | undefined;
@@ -18,6 +20,7 @@ declare abstract class BaseCommand extends Command {
catch(error: Error & {
skipOclifErrorHandling: boolean;
}): Promise<void>;
+ protected finally(error: Error | undefined): Promise<void>;
protected init(): Promise<unknown>;
protected showNpmFlagWarning(): void;
protected exitWithTimestampWhenEnvVariablePresent(): void;
@@ -25,6 +28,7 @@ declare abstract class BaseCommand extends Command {
path?: string;
verbose?: boolean;
'auth-alias'?: string;
+ 'no-input'?: boolean;
}, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(options?: Input<TFlags, TGlobalFlags, TArgs>, argv?: string[]): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {
argv: string[];
}>;
packages/cli-kit/dist/public/node/global-context.d.ts@@ -1,5 +1,6 @@
export interface GlobalContext {
currentCommandId: string;
+ inputDisabled: boolean;
}
/**
* Get the current command ID.
@@ -12,4 +13,16 @@ export declare function getCurrentCommandId(): string;
*
* @param commandId - Command ID.
*/
-export declare function setCurrentCommandId(commandId: string): void;
\ No newline at end of file
+export declare function setCurrentCommandId(commandId: string): void;
+/**
+ * Returns whether the current command explicitly disabled user input.
+ *
+ * @returns True when `--no-input` is active.
+ */
+export declare function isInputDisabled(): boolean;
+/**
+ * Controls whether the current command may request user input.
+ *
+ * @param disabled - Whether user input is disabled.
+ */
+export declare function setInputDisabled(disabled: boolean): void;
\ No newline at end of file
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Closes shop/issues-develop#23696
Scripts and agents need to disable interactive behavior independently from output format.
WHAT is this pull request doing?
--no-inputto every command.How to test your changes?
shopify store auth --helpand confirm--no-inputis listed.shopify store auth --store <store> --scopes read_products --no-inputand confirm it exits without opening a browser.Checklist