public static CommandLine parseCmdArgs(final String[] argv) {
		final CommandLineParser cmdLineParser = new DefaultParser();

		try {
			CommandLine parsed = cmdLineParser.parse(options, argv, true);
			if (parsed.hasOption(Opt.LANG.text)) {
				String language = parsed.getOptionValue(Opt.LANG.text);
				if (language != null) {
					I18n.setLanguage(language);
				}
			}
			return parsed;
		}
		catch (MissingArgumentException ex) {
			Option option = ex.getOption();
			String flag = option.getOpt();
			if (flag == null) {
				flag = option.getLongOpt();
			}
			Logger.getLogger(CowsayCli.class.getName()).log(Level.INFO, I18n.getMessage("missingarg"), flag);
		}
		catch (ParseException ex) {
			Logger.getLogger(CowsayCli.class.getName()).log(Level.FINEST, null, ex);
		}
		return null;
	}
public static CommandLine parseCmdArgs(final String[] argv) {
		final CommandLineParser cmdLineParser = new DefaultParser();

		try {
			CommandLine parsed = cmdLineParser.parse(options, argv, true);
			if (parsed.hasOption(Opt.LANG.text)) {
				String language = parsed.getOptionValue(Opt.LANG.text);
				if (language != null) {
					I18n.setLanguage(language);
				}
			}
			return parsed;
		}
		catch (MissingArgumentException ex) {
			Option option = ex.getOption();
			String flag = option.getOpt();
			if (flag == null) {
				flag = option.getLongOpt();
			}
			Logger.getLogger(CowsayCli.class.getName()).log(Level.INFO, I18n.getMessage("missingarg"), flag);
		}
		catch (ParseException ex) {
			Logger.getLogger(CowsayCli.class.getName()).log(Level.FINEST, null, ex);
		}
		return null;
	}
public static CommandLine parseCmdArgs ( final String [ ] argv ) { final CommandLineParser cmdLineParser = new DefaultParser ( ) ; try { CommandLine parsed = cmdLineParser . parse ( options , argv , true ) ; if ( parsed . hasOption ( Opt . LANG . text ) ) { String language = parsed . getOptionValue ( Opt . LANG . text ) ; if ( language != null ) { I18n . setLanguage ( language ) ; } } return parsed ; } catch ( MissingArgumentException ex ) { Option option = ex . getOption ( ) ; String flag = option . getOpt ( ) ; if ( flag == null ) { flag = option . getLongOpt ( ) ; } Logger . getLogger ( CowsayCli . class . getName ( ) ) . log ( Level . INFO , I18n . getMessage ( "missingarg" ) , flag ) ; } catch ( ParseException ex ) { Logger . getLogger ( CowsayCli . class . getName ( ) ) . log ( Level . FINEST , null , ex ) ; } return null ; }
Parses an array of arguments.
@param argv Arguments array.
@return The parsed arguments.
Parses an array of arguments .