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

more options added to cli #97 #109

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

BiswajitThakur
Copy link
Contributor

Options

$ cargo run --release -- --help
    Finished `release` profile [optimized] target(s) in 0.03s
     Running `target/release/minifier --help`
Minifier tool/lib for JS/CSS/JSON files

Usage: minifier [OPTIONS] <FILE>...

Arguments:
  <FILE>...
          Input Files...

Options:
  -t, --type <FileType>
          File Extention without dot. This option is optional.
          If you don't provide this option, all input files
          type will detect via extension of input file.
          

          Possible values:
          - css:  All the files will be consider as CSS, regardless of their extension.
          - js:   All the files will be consider as JavaScript, regardless of their extension.
          - json: All the files will be consider as JSON, regardless of their extension.

  -o, --out <output>
          Output file or directory (Default is parent dir of input files)

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version
Screencast.from.08-03-2024.07.00.52.PM.webm

src/cli.rs Outdated
let ext: Option<&FileType> = matches.get_one::<FileType>("FileType");
let out: Option<&PathBuf> = matches.get_one::<PathBuf>("output");
for i in args {
for entry in glob(i).expect("Failed to read glob pattern") {
Copy link
Owner

Choose a reason for hiding this comment

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

When would globs not be expanded by the shell?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your feedback. I included the glob pattern matching in the code to handle cases where the shell might not expand globs by default, such as when running on Windows or certain environments. However, if this isn't needed, I'm happy to update the code.

Copy link
Owner

Choose a reason for hiding this comment

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

The problem with that approach is that if there is a star on linux, then it's not supposed to be expanded. I'd prefer if you removed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed it.

@GuillaumeGomez
Copy link
Owner

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 33d05d7 into GuillaumeGomez:master Aug 12, 2024
4 checks 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.

2 participants