本文整理汇总了Java中com.sampullara.cli.Args.usage方法的典型用法代码示例。如果您正苦于以下问题:Java Args.usage方法的具体用法?Java Args.usage怎么用?Java Args.usage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sampullara.cli.Args
的用法示例。
在下文中一共展示了Args.usage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
public static void main( String[] args )
throws Exception
{
Commands command = new Commands();
try
{
Args.parse( command, args );
}
catch ( IllegalArgumentException e )
{
System.err.println( e.getMessage() );
Args.usage( command );
return;
}
ArchivaCli cli = new ArchivaCli();
try
{
cli.execute( command );
}
finally
{
cli.destroy();
}
}
示例2: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException
{
CreateLuceneIndexFromDb cr = new CreateLuceneIndexFromDb();
try
{
Args.parse(cr, args);
if (cr.config(args))
{
cr.createIndex();
}
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
Args.usage(cr);
}
}
示例3: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
public static void main( String[] args )
throws Exception
{
Commands command = new Commands();
try
{
Args.parse( command, args );
}
catch ( IllegalArgumentException e )
{
LOGGER.error( e.getMessage(), e );
Args.usage( command );
return;
}
ArchivaCli cli = new ArchivaCli();
try
{
cli.execute( command );
}
finally
{
cli.destroy();
}
}
示例4: AndroidPush
import com.sampullara.cli.Args; //导入方法依赖的package包/类
private AndroidPush(final String[] args) {
try {
Args.parse(this, args, true);
} catch (IllegalArgumentException e) {
System.err.println(e.getMessage());
System.err.println();
Args.usage(this);
System.err.println();
System.err.println("Notes:");
System.err.println(" - If deviceSerial is unset, then commands will be targeted to the only running");
System.err.println(" device. To get a list of running devices and their serial numbers, run");
System.err.println(" 'adb devices'. You can also set the ANDROID_SERIAL environment variable.");
System.err.println(" If you set the java property android.emulator.port, then this will be set");
System.err.println(" to \"emulator-XXX\", unless port is equal to \"device\" (in which case,");
System.err.println(" the only running device will be targetted) or \"emulator\" (in which case,");
System.err.println(" the only running emulator will be targetted)");
System.err.println(" - The options are passed to the executed command as it runs within the shell");
System.exit(1);
throw e;
}
}
示例5: parseArgs
import com.sampullara.cli.Args; //导入方法依赖的package包/类
void parseArgs(String... args) throws IllegalArgumentException {
List<String> rest = null;
rest = Args.parse(this, args);
if (rest == null || rest.size() != 1) {
//exit("Invalid syntax");
throw new IllegalArgumentException("missing input");
}
if (help){
Args.usage(GenerateMain.class, EXE + "" + SYNTAX);
return;
}
if (target.compareToIgnoreCase("sikuli-java-api")==0){
generator = new JavaAPICodeGenerator(name, new File(imageDir));
}else{
throw new IllegalArgumentException("Unrecognized target: " + target);
}
inputFilename = rest.get(0);
}
示例6: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
final List<String> parse;
try {
parse = Args.parse(TokenWalletCLI.class, args);
} catch (IllegalArgumentException e) {
Args.usage(TokenWalletCLI.class);
System.exit(1);
return;
}
HDWallet wallet;
if (input != null) {
String seed = new String(Files.readAllBytes(Paths.get(input)));
wallet = new HDWallet().init(seed);
} else {
wallet = new HDWallet().init(null);
}
if (output != null) {
try( PrintWriter out = new PrintWriter( output ) ){
out.println(wallet.getMasterSeed());
}
} else {
System.out.println("Seed: " + wallet.getMasterSeed());
System.out.println("Address: " + wallet.getOwnerAddress());
}
}
示例7: execute
import com.sampullara.cli.Args; //导入方法依赖的package包/类
private void execute( Commands command )
throws Exception
{
if ( command.help )
{
Args.usage( command );
}
else if ( command.version )
{
System.out.print( "Version: " + getVersion() );
}
else if ( command.convert )
{
doConversion( command.properties );
}
else if ( command.scan )
{
if ( command.repository == null )
{
System.err.println( "The repository must be specified." );
Args.usage( command );
return;
}
doScan( command.repository, command.consumers.split( "," ) );
}
else if ( command.listConsumers )
{
dumpAvailableConsumers();
}
else
{
Args.usage( command );
}
}
示例8: printHelpAndExit
import com.sampullara.cli.Args; //导入方法依赖的package包/类
@Override
public void printHelpAndExit() {
final String[] bannerLines = optionsBanner();
for (String line : bannerLines) {
System.out.println(line);
}
Args.usage(this);
System.exit(1);
}
示例9: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
CompareItems ci = new CompareItems();
try
{
Args.parse(ci, args);
ci.compare();
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
Args.usage(ci);
}
}
示例10: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
GetAvgTermFreq g = new GetAvgTermFreq();
try
{
Args.parse(g, args);
g.getDocAvgTermFreqs();
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
Args.usage(g);
}
}
示例11: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
/**
* @param args
* @throws InterruptedException
* @throws FileNotFoundException
*/
public static void main(String[] args) throws InterruptedException, FileNotFoundException {
FailFast failFast = new FailFast(Thread.currentThread());
{ // Fail Fast thread
Thread fail_fast_thread = new Thread(failFast);
fail_fast_thread.setName("fail_fast_thread");
fail_fast_thread.start();
}
try
{
Args.parse(ItemAttributesImporter.class, args);
{ // Determine opMode by checking for urlFile
if (urlFile !=null) {
opMode = OperationMode.OPERATION_MODE_FILE_IMPORTER;
}
}
DefaultApiClient client = new DefaultApiClient(apiUrl,consumerKey,consumerSecret,API_TIMEOUT);
ItemAttributesImporter fixer = new ItemAttributesImporter(client);
fixer.setFailFast(failFast);
fixer.run();
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
Args.usage(ItemAttributesImporter.class);
}
}
示例12: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
/**
* @param args
* @throws InterruptedException
* @throws FileNotFoundException
*/
public static void main(String[] args) throws InterruptedException, FileNotFoundException {
FailFast failFast = new FailFast(Thread.currentThread());
{ // Fail Fast thread
Thread fail_fast_thread = new Thread(failFast);
fail_fast_thread.setName("fail_fast_thread");
fail_fast_thread.start();
}
try
{
Args.parse(FileItemAttributesImporter.class, args);
DefaultApiClient client = new DefaultApiClient(apiUrl,consumerKey,consumerSecret,API_TIMEOUT);
FileItemAttributesImporter fixer = new FileItemAttributesImporter(client);
fixer.setFailFast(failFast);
fixer.run();
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
Args.usage(FileItemAttributesImporter.class);
}
}
示例13: main
import com.sampullara.cli.Args; //导入方法依赖的package包/类
/**
* @param args
* , three arguments, whether all the words are combined or separated
* @throws IOException
* @throws OutOfVocabularyException
*/
public static void main(String[] args) throws VectorsException, IOException {
// arguments
try {
Args.parse(ExpandQuery.class, args);
} catch (IllegalArgumentException e) {
Args.usage(ExpandQuery.class);
System.exit(1);
}
QueryExpander queryExpander = new QueryExpander(new Vectors(new FileInputStream(new File(vectorsFileName))),
combineTerms, QueryExpander.TermSelection.valueOf(termSelectionString));
// read queries, one per line
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(inputFileName), "UTF-8"));
String line = br.readLine();
line = br.readLine();
while (line != null) {
// qid and query
String[] parts = line.split(",");
String qid = parts[0];
String query = parts[1];
List<Distance.ScoredTerm> expansion = queryExpander.expand(query);
PrintWriter pw = new PrintWriter(new FileWriter(new File(outputFolderName, qid + ".terms")));
for (Distance.ScoredTerm scoredTerm : expansion)
pw.println(scoredTerm.getTerm() + "\t" + scoredTerm.getScore());
pw.close();
line = br.readLine();
}
br.close();
}
示例14: execute
import com.sampullara.cli.Args; //导入方法依赖的package包/类
private void execute( Commands command )
throws Exception
{
if ( command.help )
{
Args.usage( command );
}
else if ( command.version )
{
LOGGER.info( "Version: {}", getVersion() );
}
else if ( command.convert )
{
doConversion( command.properties );
}
else if ( command.scan )
{
if ( command.repository == null )
{
LOGGER.error( "The repository must be specified." );
Args.usage( command );
return;
}
doScan( command.repository, command.consumers.split( "," ) );
}
else if ( command.listConsumers )
{
dumpAvailableConsumers();
}
else
{
Args.usage( command );
}
}
示例15: AndroidRun
import com.sampullara.cli.Args; //导入方法依赖的package包/类
private AndroidRun(final String[] args) throws IOException, InterruptedException {
try {
final List<String> parsed = Args.parse(this, args, false);
if (parsed.size() < 1) {
throw new IllegalArgumentException("Missing <file_name>");
}
file = new File(parsed.get(0));
if (!file.exists()) {
throw new IllegalArgumentException("File '" + file + "' does not exist");
}
if (parsed.size() > 1) {
options = parsed.subList(1, parsed.size());
} else {
options = ImmutableList.of();
}
} catch (IllegalArgumentException e) {
System.err.println(e.getMessage());
System.err.println();
Args.usage(this);
System.err.println(" <file_name>");
System.err.println(" [options...]");
System.err.println();
System.err.println("Notes:");
System.err.println(" - If deviceSerial is unset, then commands will be targeted to the only running");
System.err.println(" device. To get a list of running devices and their serial numbers, run");
System.err.println(" 'adb devices'. You can also set the ANDROID_SERIAL environment variable.");
System.err.println(" If you set the java property android.emulator.port, then this will be set");
System.err.println(" to \"emulator-XXX\", unless port is equal to \"device\" (in which case,");
System.err.println(" the only running device will be targetted) or \"emulator\" (in which case,");
System.err.println(" the only running emulator will be targetted)");
System.err.println(" - The options are passed to the executed command as it runs within the shell");
System.exit(1);
throw e;
}
}