Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a kernel-style command-line parser #62

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Conversation

qookei
Copy link
Member

@qookei qookei commented Apr 26, 2023

No description provided.

include/frg/cmdline.hpp Outdated Show resolved Hide resolved
include/frg/cmdline.hpp Show resolved Hide resolved
include/frg/cmdline.hpp Show resolved Hide resolved
Copy link
Member

@no92 no92 left a comment

Choose a reason for hiding this comment

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

This PR would be nice to have for UEFI, where we might want to parse cmdline arguments in eir. Same applies for the Raspberry Pi 4 support, where this is done manually for now.

A couple of notes:

  • Adding a store_false (analogous to argparse) would be nice
  • supporting quoted arguments would be nice, but supporting escaped quotes in the middle of a quoted argument would require allocations (and can be skipped for now IMO)
  • the header is not listed for installation in the meson.build

This allows for the following usage of frg::array:
frg::array foo = {1, 2, 3};
Copy link
Member

@no92 no92 left a comment

Choose a reason for hiding this comment

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

This seems as feature-complete as I would like a basic implementation to be. Implementing features that require allocation is either out of scope or should be done later, althrough I think the former is betterer™.

LGTM.

Copy link
Member

@Dennisbonke Dennisbonke left a comment

Choose a reason for hiding this comment

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

LGTM

This parser accepts a command-line in a format similar to Linux's:
"foo bar=baz qux=12".
@qookei qookei merged commit 805d23e into managarm:master Nov 1, 2024
1 check 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.

6 participants