Skip to content

🐛 bug fix(cli.ts): properly handle the 'fgm' flag argument.#313

Merged
di-sukharev merged 1 commit intodi-sukharev:devfrom
matscube:fix/pass-fgm-flag
Mar 18, 2024
Merged

🐛 bug fix(cli.ts): properly handle the 'fgm' flag argument.#313
di-sukharev merged 1 commit intodi-sukharev:devfrom
matscube:fix/pass-fgm-flag

Conversation

@matscube
Copy link
Copy Markdown
Contributor

This PR is for fixing the bug with the 'fgm' flag.

Current Bug

When executing the oco command using the --fgm flag, the value of the fgm flag is not correctly reflected. Instead, isStageAllFlag is mistakenly treated as true.

Cause of the Bug

This is because, in the following commit, the order of arguments in the 'commit' function changed, but this was not reflected in the arguments at the call site.

a33027b

// File: commands/commit.ts

export async function commit(
  extraArgs: string[] = [],
  isStageAllFlag: Boolean = false,
  fullGitMojiSpec: boolean = false
) {
  if (isStageAllFlag) {
    ...
}

// File: cli.ts
commit(extraArgs, flags.fgm); // The value of 'flags.fgm' is being passed to 'isStageAllFlag'

Changes

  • Made sure the fgm flag argument is correctly passed to the commands/commit function in the cli file.
  • Fixed the issue of passing the value of the fgm flag to isStageAllFlag

Note

If possible, how about handling optional arguments like this with object destructuring assignment?
When there are multiple optional arguments, you can pass only the arguments you want to pass without being aware of the order of the option keys, and it is extensible even when options increase.

// File: commands/commit.ts

export async function commit(
  extraArgs: string[] = [],
  {
    isStageAllFlag = false,
    fullGitMojiSpec = false,
  }: {
    isStageAllFlag?: Boolean;
    fullGitMojiSpec?: Boolean;
  }
) {
  if (isStageAllFlag) {
    ...
}

// File: cli.ts
commit(extraArgs, { fullGitMojiSpec: flags.fgm });

Best regards

@matscube matscube changed the title bug fix(cli.ts): properly handle the 'fgm' flag argument. 🔧 bug fix(cli.ts): properly handle the 'fgm' flag argument. Mar 17, 2024
@matscube matscube changed the title 🔧 bug fix(cli.ts): properly handle the 'fgm' flag argument. 🐛 bug fix(cli.ts): properly handle the 'fgm' flag argument. Mar 17, 2024
@di-sukharev di-sukharev merged commit c39181e into di-sukharev:dev Mar 18, 2024
@di-sukharev
Copy link
Copy Markdown
Owner

will be in the next patch version

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