Skip to content

feat/refactor_args#100

Merged
bpetit merged 8 commits intohubblo-org:mainfrom
uggla:feat/refactor_args
Apr 27, 2021
Merged

feat/refactor_args#100
bpetit merged 8 commits intohubblo-org:mainfrom
uggla:feat/refactor_args

Conversation

@uggla
Copy link
Copy Markdown
Collaborator

@uggla uggla commented Apr 22, 2021

  • Refactor completed.
  • This will be useful/needed for Riemann mTLS.
  • Goal is to define args on the exporters to allow a maximum
    flexibility. (usage of various options like group options etc...)
  • Avoid the code in main to choose between args with default values and
    no default values as this is not flexible at all.
 if let Some(default_value) = &opt.default_value {
                let arg = Arg::with_name(key)
                    .required(opt.required)
                    .takes_value(opt.takes_value)
                    .default_value(default_value)
                    .short(&opt.short)
                    .long(&opt.long)
                    .help(&opt.help);
                subcmd = subcmd.arg(arg);
            } else {
                let arg = Arg::with_name(key)
                    .required(opt.required)
                    .takes_value(opt.takes_value)
                    .short(&opt.short)
                    .long(&opt.long)
                    .help(&opt.help);
                subcmd = subcmd.arg(arg);
            }
  • All help outputs have been checked and are identical as the ones before the refactoring.

- Sample showing a started refactor for riemann.
- This will be useful/needed for Riemann mTLS.
- Goal is to define args on the exporters to allow a maximum
  flexibility. (usage of various options like group options etc...)
- Avoid the code in main to choose between args with default values and
  no default values as this is not flexible at all.
@uggla uggla force-pushed the feat/refactor_args branch from 0ab8ce8 to 818ca21 Compare April 22, 2021 22:53
uggla added 7 commits April 24, 2021 16:02
- Refactor args for Riemann.
- Refactor args for Stdout.
- Refactor args for Json.
- Refactor args for Prometheus.
- Refactor args for Qemu.
- Refactor args for Warp10.
- Finalize refactor.
@uggla uggla requested a review from bpetit April 24, 2021 23:43
@uggla uggla changed the title WIP: feat/refactor_args feat/refactor_args Apr 24, 2021
@uggla
Copy link
Copy Markdown
Collaborator Author

uggla commented Apr 24, 2021

Finally I did it completely, it makes the code simple and more flexible. However it will conflict with #98.
@bpetit, I don't know which MR should be merged first between #98 and #100, but maybe this one first will cause less rework.
If you merge this one, I will rebase #98 and fix -p / -r behavior as soon as we agree about it.

@bpetit
Copy link
Copy Markdown
Contributor

bpetit commented Apr 27, 2021

This is great, thanks. I agree on merging this one too before merging #98
The CI server has a weird behavior, I have to fix that. In the meantime, I just ran the whole test procedure on a machine of mine. If it's successful, I'll merge this one.

@bpetit bpetit merged commit a7b0159 into hubblo-org:main Apr 27, 2021
@uggla
Copy link
Copy Markdown
Collaborator Author

uggla commented Apr 28, 2021

👍 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Previous releases

Development

Successfully merging this pull request may close these issues.

2 participants