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

Improve command line argument handling #87

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gekkowrld
Copy link
Contributor

Handle arguments passed into the program through .
Partially conforms to the GNU Argument Syntax:
https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html

Flags are handled first before the arguments.
If an flag passed is incorrect, then an error is returned.
Flags handled as of now include:
-h, --help: For printing help messages
-m, --msaada: Kuonyesha usaidizi
-v, --version, -t, --toleo: Showing the version
Previous implementation supported flags like:
--docs (should be an argument)
-docs
-version
-msaada
-help
-toleo
This flags do not conform to the GNU Argument Syntax.
If any of this flag is passed, then the program prints the information and exits.

Arguments processed after the flags.
Arguments supported as of now are that of filename.
Any of the argument passed is treated as a filename and may fail if not one.
Prevoius implementation allowed arguments like:
version
msaada
help
v
This are not supported as of now.

Error messages are printed to stderr instead of stdout.

Signed-off-by: Gekko Wrld [email protected]

Handle arguments passed into the program through <stdin>.
Partially conforms to the GNU Argument Syntax:
https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html

Flags are handled first before the arguments.
If an flag passed is incorrect, then an error is returned.
Flags handled as of now include:
	-h, --help: For printing help messages
	-m, --msaada: Kuonyesha usaidizi
	-v, --version, -t, --toleo: Showing the version
Previous implementation supported flags like:
	--docs (should be an argument)
	-docs
	-version
	-msaada
	-help
	-toleo
This flags do not conform to the GNU Argument Syntax.
If any of this flag is passed, then the program prints the information and exits.

Arguments processed after the flags.
Arguments supported as of now are that of filename.
Any of the argument passed is treated as a filename and may fail if not one.
Prevoius implementation allowed arguments like:
	version
	msaada
	help
	v
This are not supported as of now.

Error messages are printed to stderr instead of stdout.

Signed-off-by: Gekko Wrld <[email protected]>
Copy link
Member

@AvicennaJr AvicennaJr left a comment

Choose a reason for hiding this comment

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

Looks good. I'll make a few more changes before merging.

@AvicennaJr
Copy link
Member

Do not that we have to change the docs and readme, everywhere that references the previous flags. Will also have to add a -d, --docs.

@AvicennaJr
Copy link
Member

AvicennaJr commented Jun 11, 2024

Actually I realized you removed the --docs flags. Have you tried that option? And why have it removed?

@gekkowrld
Copy link
Contributor Author

Actually I realized you removed the --docs flags. Have you tried that option? And why have it removed?

Didn't realize it was there until now. But since you'll be changing some things, you can add it in.

@gekkowrld
Copy link
Contributor Author

gekkowrld commented Jun 11, 2024

I'll be making a change in a few minutes before you merge.

*edit: No further changes

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.

None yet

2 participants