Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xiyuan-fengyu/javaargs
command line args parse
https://github.com/xiyuan-fengyu/javaargs
args argsparse command-line command-line-args command-line-args-parse java parse
Last synced: about 5 hours ago
JSON representation
command line args parse
- Host: GitHub
- URL: https://github.com/xiyuan-fengyu/javaargs
- Owner: xiyuan-fengyu
- Created: 2017-10-19T08:18:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T09:09:29.000Z (about 7 years ago)
- Last Synced: 2023-12-20T23:19:56.293Z (11 months ago)
- Topics: args, argsparse, command-line, command-line-args, command-line-args-parse, java, parse
- Language: Java
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JavaArgs
command line args parse**Quick Start**
[src/test/java/QuickStart.java](src/test/java/QuickStart.java)
```java
import com.xiyuan.args.Args;
import com.xiyuan.args.ArgsExp;public class QuickStart extends Args{
//ArgExp fromat:
//commandName [optionName] [optionName] (optionName) >
//commandName can be empty str
//[optionName] is a optional arg
//[optionName] is a optional arg, if exist, value is true, else false
//(optionName) is a required arg matched by optionName
//> is a required arg matched by the index of args which are not matched by others
@ArgsExp(exp = "start" +
" [-t<10><\\d+>]" +
" [-p]" +
" (-n<\\d+>)" +
"public static void main(String[] args) {
QuickStart quickStart = new QuickStart();
quickStart.execute("start -t 20 -n 1000 60000");
quickStart.execute("start 80000 -p -n 1000");
}}
```output
```
_t = [20], _p = [false], _n = [1000], time = [60000]
_t = [10], _p = [true], _n = [1000], time = [80000]
```**More example**
[src/test/java/Test.java](src/test/java/Test.java)