https://github.com/9seconds/ccli
CleanCli is small, fast, convenient and flexible alternative to Apache Commons Cli
https://github.com/9seconds/ccli
Last synced: about 1 year ago
JSON representation
CleanCli is small, fast, convenient and flexible alternative to Apache Commons Cli
- Host: GitHub
- URL: https://github.com/9seconds/ccli
- Owner: 9seconds
- Created: 2011-08-12T22:53:41.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-08-20T12:52:52.000Z (almost 15 years ago)
- Last Synced: 2025-02-01T06:41:36.866Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 266 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CleanCLI library
================
_Please note that this help is not sufficient, it contains examples of usage
only. I will write complete guide ASAP._
Usage examples
--------------
```java
// java Lame --vbr-new -V0 --noreplaygain -q 0 -m j awesometune.wav awesomefile.mp3
import org.aerialsounds.ccli.*
import java.util.Iterator;
public class Lame {
static public void main(String[] args) {
CCli repository = new CCli(args);
Option vbrNew = repository.createOption(
OptionTypes.LONG,
"vbr-new",
false,
ValueTypes.BOOLEAN,
"Detected new mode for VBR"
);
Option useReplayGain = repository.createOption(
OptionTypes.CUSTOM,
"--noreplaygain",
false,
ValueTypes.BOOLEAN,
"Does ReplayGain should be used?"
);
Option vBitrate = repository.createOption(
OptionTypes.SHORT,
"V",
2,
ValueTypes.INTEGER,
"Detects VBR quality algorithm"
);
Option stereoMode = repository.createOption(
OptionTypes.SHORT,
"m",
'c',
ValueTypes.CHAR,
"Detects stereo mode"
);
Option qBitrate = repository.createOption(
OptionTypes.SHORT,
"q",
2,
ValueTypes.INTEGER,
"Detects quality algorithm"
);
Option preset = repository.createOption(
OptionTypes.LONG,
"preset",
"normal",
ValueTypes.STRING,
"Detects encoding preset"
);
try {
repository.parse();
}
catch ( CannotParse ) {
System.out.println("Cannot parse such commandline!\n");
System.out.pirntln(repository.help());
}
System.out.println("vbrNew = " + (Boolean) vbrNew.getValue()); // vbrNew = true
System.out.println("useReplayGain = " + (Boolean) useReplayGain.getValue()); // useReplayGain = true
System.out.println("stereoMode = " + (Character) stereoMode.getValue()); // stereoMode = j
System.out.println("qBitrate = " + (Integer) qBitrate.getValue()); // qBitrate = 0
System.out.println("vBitrate = " + (Integer) vBitrate.getValue()); // vBitrate = 0
System.out.println("preset = " + (String) preset.getValue()); // preset = normal
Iterator appArgs = repository.getApplicationArguments();
System.out.println("inputFile is " + appArgs.next()); // inputFile is awesometune.wav
System.out.println("outputFile is " + appArgs.next()); // outputFile is awesomefile.mp3
}
}
```