Skip to content

Commit 3e794df

Browse files
committed
feat(cli): add help flags and update usage documentation
1 parent c434947 commit 3e794df

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
## Usage
2121
```
22-
xa-interleaver <input> <stride> <2336/2352> <output>
22+
xa-interleaver <input> <stride> <size> <output>
2323
```
2424
```
25-
xa-deinterleaver <input> <2336/2352> <output>
25+
xa-deinterleaver <input> <size> <output>
2626
```
2727

2828
### Commands
@@ -35,13 +35,13 @@ xa-deinterleaver <input> <2336/2352> <output>
3535
Required:
3636
```
3737
<input> For interleave can be a .csv, .txt, or any text file properly formated.
38-
For deinterleave can be any mixed audio file. A CD image file (bin/iso) can work, but is not recommended.
38+
For deinterleave can be any mixed audio file. A .bin CD image file works, but is not recommended.
3939
```
4040
Optional:
4141
```
4242
<stride> (Only for interleave) Stride of sectors to interleave, 2/4/8/16/32. Defaults to 8
43-
<2336/2352> Output file sector size (2336 or 2352). Defaults to input file (or the first file in the manifest) sector size
44-
<output> Optional output file(s) path. Defaults to input file path
43+
<size> Optional output file sector size (2336 or 2352). Defaults to input file (or the first file in the manifest) sector size
44+
<output> Optional output dir/file path. Defaults to input dir/file path
4545
```
4646
Examples:
4747
```

‎xa-deinterleaver.cxx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
int main(int argc, char *argv[])
55
{
6-
if (argc < 2)
6+
if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
77
{
8-
printf("xa-deinterleaver " VER " by N4gtan\n\n");
9-
printf(" Usage: xa-deinterleaver <input> <2336/2352> <output>\n\n");
10-
printf(" Input: XA interleaved file\n");
11-
printf("2336/2352: Output file sector size (2336 or 2352). Defaults to input file sector size\n");
12-
printf(" Output: Optional output file(s) path. Defaults to input file path\n");
8+
printf("xa-deinterleaver " VER " by N4gtan\n\n"
9+
" Usage: xa-deinterleaver <input> <size> <output>\n\n"
10+
" Input: XA interleaved file\n"
11+
" Size: Optional output file sector size (2336 or 2352). Defaults to input file sector size\n"
12+
"Output: Optional output directory path. Defaults to input directory path\n");
1313
return EXIT_SUCCESS;
1414
}
1515

‎xa-interleaver.cxx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
int main(int argc, char *argv[])
55
{
6-
if (argc < 2)
6+
if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
77
{
8-
printf("xa-interleaver " VER " by N4gtan\n\n");
9-
printf(" Usage: xa-interleaver <input> <stride> <2336/2352> <output>\n\n");
10-
printf(" Input: Manifest .csv file (or any text file with the appropriate format)\n");
11-
printf(" Stride: Stride of sectors to interleave. Defaults to 8\n");
12-
printf("2336/2352: Output file sector size (2336 or 2352). Defaults to first file sector size\n");
13-
printf(" Output: Optional output file path. Defaults to input file path\n");
8+
printf("xa-interleaver " VER " by N4gtan\n\n"
9+
" Usage: xa-interleaver <input> <stride> <size> <output>\n\n"
10+
" Input: Manifest .csv file (or any text file with the appropriate format)\n"
11+
"Stride: Optional stride of sectors to interleave (2/4/8/16/32). Defaults to 8\n"
12+
" Size: Optional output file sector size (2336 or 2352). Defaults to first file sector size\n"
13+
"Output: Optional output file path. Defaults to input file path\n");
1414
return EXIT_SUCCESS;
1515
}
1616

@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
2626
return EXIT_FAILURE;
2727
}
2828

29-
const std::filesystem::path outputPath = argc >= 4 ? argv[3] : inputFile.stem() += "_NEW.XA";
29+
const std::filesystem::path outputPath = argc >= 5 ? argv[4] : inputFile.parent_path() / inputFile.stem() += "_NEW.XA";
3030
FILE *outputFile = fopen(outputPath.string().c_str(), "w+b");
3131
if (!outputFile)
3232
{

0 commit comments

Comments
 (0)