• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Args类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sampullara.cli.Args的典型用法代码示例。如果您正苦于以下问题:Java Args类的具体用法?Java Args怎么用?Java Args使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Args类属于com.sampullara.cli包,在下文中一共展示了Args类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parse

import com.sampullara.cli.Args; //导入依赖的package包/类
public <T> T parse(String[] args, T inputArgs, Function<? super T, String> validationFunction) {
    try {
        List<String> extraArgs = Args.parse(inputArgs, args);

        if (extraArgs.size() > 0) {
            printUsageAndExit(inputArgs, "Passed in unnecessary args: " + StringUtils.join(extraArgs, "; "));
        }

        String validationMessage = validationFunction.valueOf(inputArgs);
        if (validationMessage != null) {
            printUsageAndExit(inputArgs, validationMessage);
        }
    } catch (IllegalArgumentException exc) {
        printUsageAndExit(inputArgs, ExceptionUtils.getStackTrace(exc));
    }

    LOG.info("Arguments parsed: " + inputArgs.toString());
    
    return inputArgs;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:ArgsParser.java


示例2: 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();
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:27,代码来源:ArchivaCli.java


示例3: main

import com.sampullara.cli.Args; //导入依赖的package包/类
public static void main(String[] args) {
  Standalone instance = new Standalone();
  List<String> projectPaths;
  try {
    projectPaths = Args.parse(instance, args);
  }
  catch (Exception e) {
    printUsageAndExit();
    return;
  }

  if (projectPaths.isEmpty()) {
    System.out.println("Path to project is not specified");
    printUsageAndExit();
  }
  if (projectPaths.size() > 1) {
    System.out.println("Only one project can be specified");
    printUsageAndExit();
  }

  final String projectPath = (new File(projectPaths.get(0))).getAbsolutePath();
  int exitCode = instance.loadAndRunBuild(FileUtil.toCanonicalPath(projectPath));
  System.exit(exitCode);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:Standalone.java


示例4: 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);
		}	
}
 
开发者ID:SeldonIO,项目名称:semantic-vectors-lucene-tools,代码行数:18,代码来源:CreateLuceneIndexFromDb.java


示例5: main

import com.sampullara.cli.Args; //导入依赖的package包/类
public static void main(String[] args) {
  Standalone instance = new Standalone();
  List<String> projectPaths;
  try {
    projectPaths = Args.parse(instance, args);
  }
  catch (Exception e) {
    printUsageAndExit();
    return;
  }

  if (projectPaths.isEmpty()) {
    System.out.println("Path to project is not specified");
    printUsageAndExit();
  }
  if (projectPaths.size() > 1) {
    System.out.println("Only one project can be specified");
    printUsageAndExit();
  }

  instance.loadAndRunBuild(projectPaths.get(0));
  System.exit(0);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:Standalone.java


示例6: 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();
    }
}
 
开发者ID:apache,项目名称:archiva,代码行数:27,代码来源:ArchivaCli.java


示例7: 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;
    }
}
 
开发者ID:k9webprotection,项目名称:maven-native-oat,代码行数:22,代码来源:AndroidPush.java


示例8: 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);		
}
 
开发者ID:sikuli,项目名称:sikuli-slides,代码行数:22,代码来源:GenerateMain.java


示例9: 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());
    }

}
 
开发者ID:toshiapp,项目名称:toshi-headless-client,代码行数:29,代码来源:TokenWalletCLI.java


示例10: main

import com.sampullara.cli.Args; //导入依赖的package包/类
public static void main(final String[] arguments)
{
   final Main instance = new Main();
   final List<String> unparsed = Args.parseOrExit(instance, arguments);
   if (!unparsed.isEmpty())
   {
      out.println("Unparsed arguments: " + unparsed);
   }
   out.println("File path/name is '" + instance.file + "' and verbosity is " + instance.verbose);
}
 
开发者ID:dustinmarx,项目名称:java-cli-demos,代码行数:11,代码来源:Main.java


示例11: 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 );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:36,代码来源:ArchivaCli.java


示例12: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AbstractInspectionCmdlineOptions.java


示例13: 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);
	}	

}
 
开发者ID:SeldonIO,项目名称:semantic-vectors-lucene-tools,代码行数:15,代码来源:CompareItems.java


示例14: 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);
	}	

}
 
开发者ID:SeldonIO,项目名称:semantic-vectors-lucene-tools,代码行数:15,代码来源:GetAvgTermFreq.java


示例15: 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);
	}	
}
 
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:38,代码来源:ItemAttributesImporter.java


示例16: 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);
	}	
}
 
开发者ID:SeldonIO,项目名称:seldon-server,代码行数:33,代码来源:FileItemAttributesImporter.java


示例17: 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();

}
 
开发者ID:saadtazi,项目名称:word2vec-query-expansion,代码行数:41,代码来源:ExpandQuery.java


示例18: 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 );
    }
}
 
开发者ID:apache,项目名称:archiva,代码行数:36,代码来源:ArchivaCli.java


示例19: 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;
    }
}
 
开发者ID:k9webprotection,项目名称:maven-native-oat,代码行数:38,代码来源:AndroidRun.java


示例20: 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");
	}
	context = parseContext();		
	String input = rest.get(0);		
	url = parseInputAsURL(input);
}
 
开发者ID:sikuli,项目名称:sikuli-slides,代码行数:12,代码来源:ExecuteMain.java



注:本文中的com.sampullara.cli.Args类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UsageType类代码示例发布时间:2022-05-21
下一篇:
Java StorageException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap