Skip to content

Conversation

@CassioMasteguim
Copy link

No description provided.

Comment on lines +8 to +10
.idea/
cotuba-cli.iml

Copy link
Contributor

Choose a reason for hiding this comment

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

Boa!


import org.apache.commons.cli.*;

public class OptionCLIReader {
Copy link
Contributor

Choose a reason for hiding this comment

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

O projeto já estava usando as variáveis em português. Por isso, acho que seria melhor manter o nome da classe em português.

Comment on lines +13 to +36
Options options = new Options();

options.addOption(new Option("d", "dir", true, "Diretório que contem os arquivos md. Default: diretório atual."));
options.addOption(new Option("f", "format", true, "Formato de saída do ebook. Pode ser: pdf ou epub. Default: pdf"));
options.addOption(new Option("o", "output", true, "Arquivo de saída do ebook. Default: book.{formato}."));
options.addOption(new Option("v", "verbose", false, "Habilita modo verboso."));

CommandLineParser cmdParser = new DefaultParser();
HelpFormatter ajuda = new HelpFormatter();
CommandLine cmd;

try {
cmd = cmdParser.parse(options, args);
} catch (ParseException e) {
System.err.println(e.getMessage());
ajuda.printHelp("cotuba", options);
System.exit(1);
return;
}

this.nomeDoDiretorioDosMD = cmd.getOptionValue("dir");
this.nomeDoFormatoDoEbook = cmd.getOptionValue("format");
this.nomeDoArquivoDeSaidaDoEbook = cmd.getOptionValue("output");
this.modoVerboso = cmd.hasOption("verbose");
Copy link
Contributor

Choose a reason for hiding this comment

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

Você acha que seria bom reorganizar esse trecho de código? Se sim, como você faria?

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