Skip to content

fix: make -m/--mode a required argument#34

Merged
Adamtaranto merged 1 commit into
flexidot-bio:masterfrom
themavik:fix-mode-required-argument
Feb 12, 2026
Merged

fix: make -m/--mode a required argument#34
Adamtaranto merged 1 commit into
flexidot-bio:masterfrom
themavik:fix-mode-required-argument

Conversation

@themavik

Copy link
Copy Markdown
Contributor

Summary

When no -m flag is provided, args.mode is None (since action='append' defaults to None rather than an empty list). This causes a TypeError: 'NoneType' object is not iterable in print_summary() at line 87 of utils/checks.py.

Changes

  • Add required=True to the -m/--mode argument in parse_args()
  • Remove misleading [default] from the help text for mode 0 (there is no default when the argument is required)

Behavior

Before:

$ flexidot -i input.fasta
TypeError: 'NoneType' object is not iterable

After:

$ flexidot -i input.fasta
usage: flexidot [-h] ... -m {0,1,2} ...
flexidot: error: the following arguments are required: -m/--mode

Test Plan

  • flexidot -i input.fasta without -m: now shows a clear argparse error instead of crashing
  • flexidot -i input.fasta -m 0: unchanged behavior
  • flexidot -i input.fasta -m 0 -m 2: multiple modes still work via action='append'

Fixes #32

When no -m flag is provided, args.mode is None (since action='append'
defaults to None). This causes a TypeError in print_summary() which
iterates over args.mode.

Mark the argument as required=True so argparse emits a clear usage
error instead of crashing with an unhelpful traceback. Also remove
"[default]" from the help text for mode 0 since there is no longer
a default.

Fixes #32

Co-authored-by: Cursor <cursoragent@cursor.com>
@Adamtaranto Adamtaranto self-requested a review February 11, 2026 07:33
@Adamtaranto Adamtaranto self-assigned this Feb 11, 2026
@Adamtaranto Adamtaranto added the fix fixes a known issue label Feb 11, 2026
@Adamtaranto

Copy link
Copy Markdown
Collaborator

Thanks. I will test and check if any of the docs need updating.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a CLI crash path where omitting -m/--mode leaves args.mode=None, causing print_summary() to throw a TypeError. It makes -m/--mode an argparse-required option so the CLI fails fast with a clear usage error instead of crashing later.

Changes:

  • Mark -m/--mode as required=True while keeping action='append' for multi-mode support.
  • Adjust the --mode help text to remove the misleading “[default]” wording.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/flexidot/utils/args.py
Comment thread src/flexidot/utils/args.py
@Adamtaranto Adamtaranto removed their request for review February 12, 2026 00:26
@Adamtaranto Adamtaranto merged commit e3b0200 into flexidot-bio:master Feb 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix fixes a known issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make 'mode' a required argument

3 participants