Bladeren bron

proper reading spec from stdin

master
Jonathan Cobb 4 jaren geleden
bovenliggende
commit
4a7ee878ce
4 gewijzigde bestanden met toevoegingen van 12 en 11 verwijderingen
  1. +4
    -0
      README.md
  2. +3
    -5
      bin/jtrim
  3. +2
    -3
      bin/jvcl
  4. +3
    -3
      src/main/java/jvcl/main/JvclOptions.java

+ 4
- 0
README.md Bestand weergeven

@@ -72,6 +72,10 @@ To execute a spec stored in the file `my-spec.json`, you would run:
```shell script
jvcl my-spec.jvcl
```
or to supply a spec using stdin and pipeline:
```shell script
cat my-spec.jvcl | jvcl
```

#### Scratch Directory
Output assets will be placed in the scratch directory, unless otherwise specified


+ 3
- 5
bin/jtrim Bestand weergeven

@@ -31,11 +31,9 @@ echo "
\"name\": \"trimmed\",
\"dest\": \"${OUT_FILE}\"
},
\"perform\": {
\"trim\": \"input\",
\"start\": \"${T_START}s\",
\"end\": \"${T_END}s\"
}
\"trim\": \"input\",
\"start\": \"${T_START}\",
\"end\": \"${T_END}\"
}
]
}


+ 2
- 3
bin/jvcl Bestand weergeven

@@ -4,10 +4,9 @@
#
# Usage:
#
# jvcl [-f spec-file] [-t temp-dir]
# jvcl [-t temp-dir] spec-file
#
# If the `-f` option is omitted and no spec-file is provided, then jvcl will try to read
# a spec from stdin.
# If `spec-file` is omitted, then jvcl will try to read a spec from stdin.
#
# Every run of JVCL will create a temp directory. You can either specify the name of the directory
# with `-t` (it will be created if it does not exist), or let jvcl create a temp directory for you.


+ 3
- 3
src/main/java/jvcl/main/JvclOptions.java Bestand weergeven

@@ -21,13 +21,13 @@ import static org.cobbzilla.util.json.JsonUtil.json;
@Slf4j
public class JvclOptions extends BaseMainOptions {

public static final String USAGE_SPEC = "Spec file to run. Set to '-' to read from stdin.";
@Argument(usage=USAGE_SPEC, required=true)
public static final String USAGE_SPEC = "Spec file to run. If omitted, read spec from stdin.";
@Argument(usage=USAGE_SPEC)
@Getter @Setter private File specFile;

public JSpec getSpec() {
final String json;
if (specFile != null && !specFile.getName().equals("-")) {
if (specFile != null) {
if (!specFile.exists() || !specFile.canRead()) return die("File not found or unreadable: "+abs(specFile));
json = toStringOrDie(specFile);
} else {


Laden…
Annuleren
Opslaan