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

Make --help output more detailed. #70

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

Conversation

sebastiancarlos
Copy link

@sebastiancarlos sebastiancarlos commented Nov 28, 2023

Hello,

For my personal use, I updated the --help output to clarify a bit the behavior (particularly highlighting the importance of putting everything compiler-related in the first argument, and the need for a final -- in that argument when used as a shebang.

Current --help:

Usage: c <file.c ... | compiler_options ...> [program_arguments]
       c --clear-cache
Execute C programs from the command line.

  Ex: c main.c
  Ex: c main.c arg1 arg2
  Ex: c 'main.c other.c' arg1 arg2
  Ex: c 'main.c -lncurses' arg1 arg2

This PR's --help:

Usage:
       c '<file.c ... | compiler_options ...>' [program_arguments]
       c --clear-cache

Usage for shebang with extra compiler options:
       c '<other.c ... | compiler_options ...> --' <file.c> [program_arguments]

Execute C programs from the command line.

  Ex: c main.c
  Ex: c main.c arg1 arg2
  Ex: c 'main.c other.c' arg1 arg2
  Ex: c 'main.c -lncurses' arg1 arg2

Execute C programs when "main.c" is executable with shebang.

  Shebang: #!/usr/bin/env c
  Shebang: #!/usr/bin/env -S c 'other.c --'
  Shebang: #!/usr/bin/env -S c '-lncurses --'
  Ex:      ./main.c
  Ex:      ./main.c arg1 arg2

Feel free to merge if you like it. Cheers!

Copy link

@Imran-imtiaz48 Imran-imtiaz48 left a comment

Choose a reason for hiding this comment

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

Review: A Practical Script for On-the-Go C Compilation
This script is a no-nonsense utility for compiling and running C programs straight from the command line. It doesn't waste time with fluff or hand-holding, which is perfect for developers who just want results. The help_msg function is clear and concise, laying out the usage in plain terms, complete with examples. The inclusion of shebang handling shows some real foresight—making it easy to execute C programs directly like any other script.
What stands out here is the practical focus. This isn't a tool trying to impress you with flashy features or over-engineered solutions. It's straightforward: "Here’s how you use it. Here’s what you get." It’s like a well-built tool that does its job without needing applause.
That said, there’s always room for a little refinement. For instance, some error handling in cleanup might need sharpening to keep things robust in diverse environments. But overall, this script feels like it was written by someone who actually works in the trenches of development—not a hobbyist.
In short: practical, efficient, and gets the job done. If you work with C and need quick results, this script's a solid addition to your toolbox.

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