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

Playground #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Playground #1

wants to merge 2 commits into from

Conversation

DevCapu
Copy link

@DevCapu DevCapu commented Jul 9, 2020

Separando o leitor em uma classe e cada opção se tornou um valor do enum, com um construtor padrão

Comment on lines +12 to +13
VERBOSE(new Option("o", "output", true,
"Arquivo de saída do ebook. Default: book.{formato}."));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Peguei um bug aqui

Suggested change
VERBOSE(new Option("o", "output", true,
"Arquivo de saída do ebook. Default: book.{formato}."));
VERBOSE(new Option("v", "verbose", false, "Habilita modo verboso."));

Option opcaoModoVerboso = new Option("v", "verbose", false,
"Habilita modo verboso.");

Copy link
Author

Choose a reason for hiding this comment

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

Ah sim, um dos problemas de usar CTRL+ C e CTRL+ V sem prestar atenção, vou corrigir.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Esse problema é um clássico! Hehe

Comment on lines +65 to +80
private Options initializeOptions() {
Options options = new Options();

Option opcaoDeDiretorioDosMD = CommandLineOptions.DIR.getOption();
options.addOption(opcaoDeDiretorioDosMD);

Option opcaoDeFormatoDoEbook = CommandLineOptions.FORMAT.getOption();
options.addOption(opcaoDeFormatoDoEbook);

Option opcaoDeArquivoDeSaida = CommandLineOptions.OUTPUT.getOption();
options.addOption(opcaoDeArquivoDeSaida);

Option opcaoModoVerboso = CommandLineOptions.VERBOSE.getOption();
options.addOption(opcaoModoVerboso);
return options;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Aqui, talvez a responsabilidade de criar as opções possa ser da própria enum.

Na enum, você pode ter um método getOptions que cria o Options e adiciona cada uma. Toda enum tem um método values retorna um Array com os valores da enum. Aí, você pode fazer um for each, e ir pegando o option e adicionando.

Aí, teria um getOptions na própria enum e não precisaria do getOption.

O que acha?

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