Skip to content

Conversation

@kaushikwavhal
Copy link
Contributor

Add --skip-if-env option to override command

Summary

Adds a new --skip-if-env <ENV_VAR> option to the override command that skips execution when the specified environment variable is set.

Usage

yarn build-flags override --skip-if-env EAS_BUILD +localFlag -otherFlagWhen EAS_BUILD is set in the environment, the command logs a skip message and exits without modifying flags.

Changes

  • Added getOptionValue helper to extract option values from args
  • Updated parseArgs to handle --skip-if-env option
  • Added skip logic in the override command handler
  • Updated help text with new option
  • Added unit tests for argument parsing
  • Updated README documentation

Copy link
Collaborator

@sterlingwes sterlingwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Couple suggestions

Thanks for backfilling more specs ✨ 😌

src/cli/main.ts Outdated
.filter((_, i) => {
const originalIndex = i + 2;
return originalIndex !== skipIfEnvIndex && originalIndex !== skipIfEnvIndex + 1;
});
Copy link
Collaborator

@sterlingwes sterlingwes Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

splice here would be fine if we created a copy of the args argument to be safe?

const commandArgs = args.slice();
const skipIfEnvIndex = commandArgs.indexOf("--skip-if-env");
const skipIfEnv = skipIfEnvIndex > 0 ? commandArgs[skipIfEnvIndex + 1] : null;
commandArgs.splice(skipIfEnvIndex, 2);

also allows for getting rid of getOptionValue alongside the filter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea!

src/cli/main.ts Outdated
if (command === "override") {
if (shouldSkip(skipIfEnv)) {
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we put this at the top of the run() here b/c the way it's documented it's a global CLI option and not specific to one command

Copy link
Collaborator

@sterlingwes sterlingwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice all good after these

src/cli/main.ts Outdated
const flagsToEnable = new Set<string>();
args.slice(2).forEach((arg) => {

const argsCopy = [...args].slice(2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slice returns a copy i believe so the spread is not necessary here

Kaushik Wavhal and others added 2 commits December 11, 2025 10:59
@sterlingwes sterlingwes changed the title Adds skip override flag fix(cli): adds skip override flag Dec 11, 2025
@sterlingwes sterlingwes merged commit e0eb5a1 into Fullscript:main Dec 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants