Skip to content

fix(cli): honor positional input file#3922

Open
Nandann018-ux wants to merge 1 commit intomarkedjs:masterfrom
Nandann018-ux:codex/cli-positional-input
Open

fix(cli): honor positional input file#3922
Nandann018-ux wants to merge 1 commit intomarkedjs:masterfrom
Nandann018-ux:codex/cli-positional-input

Conversation

@Nandann018-ux
Copy link
Copy Markdown

Marked version:

17.0.5

Markdown flavor: n/a

Description

  • Issue: The CLI ignores a positional input file and reads stdin instead.
  • Expectation: marked README.md should parse the file.
  • Result: marked README.md waits on stdin or emits empty output unless stdin is provided.
  • What was attempted: Verified arg parsing; getData always preferred stdin when no --input.
  • Fix: Prefer --string, then the last positional argument as input file, and fall back to stdin only when no inputs exist.
  • Tests: npm run build, npm run test:unit

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 22, 2026

@Nandann018-ux is attempting to deploy a commit to the MarkedJS Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where the marked CLI tool was not correctly processing positional input files, instead defaulting to stdin. The changes ensure that the CLI prioritizes command-line arguments and positional file inputs before falling back to stdin, providing a more intuitive user experience. A new test case has been added to confirm the fix.

Highlights

  • CLI Input Handling: The CLI now correctly handles positional input files, addressing an issue where it would ignore the file and default to reading from stdin.
  • Fix Implementation: The fix prioritizes the --string argument, then the last positional argument as the input file, and falls back to stdin only when no inputs are provided.
  • Testing: A new unit test was added to verify that the CLI correctly parses a positional input file.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where the CLI would ignore a positional input file and read from stdin instead. The change correctly adjusts the logic to prioritize input from the --string option, then a positional file argument, and finally stdin. A unit test has been added to verify the fix for positional arguments. My feedback includes a suggestion to make the new test more robust by verifying that it's specifically the last positional argument that is used, as per the intended logic.

Copy link
Copy Markdown
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this 💯

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marked-website Ready Ready Preview, Comment Mar 23, 2026 2:01am

Request Review

@Nandann018-ux
Copy link
Copy Markdown
Author

@calculuschild @styfle can u pls review my pr

@Nandann018-ux
Copy link
Copy Markdown
Author

@UziTech can you please get my pr merged?

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