Skip to content

Commit 86506ce

Browse files
committed
allow no subdirectories and update usage
1 parent a939f0e commit 86506ce

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ Biasing the distribution this way ensures that each directory has a similar numb
99
* Download Binary
1010
- curl
1111
```sh
12-
sudo curl https://github.com/joshuaboud/gen-dataset/releases/download/v1.1/gen-dataset -o /usr/local/bin/gen-dataset
12+
sudo curl https://github.com/joshuaboud/gen-dataset/releases/download/v1.2/gen-dataset -o /usr/local/bin/gen-dataset
1313
```
1414
- wget
1515
```sh
16-
sudo wget https://github.com/joshuaboud/gen-dataset/releases/download/v1.1/gen-dataset -P /usr/local/bin
16+
sudo wget https://github.com/joshuaboud/gen-dataset/releases/download/v1.2/gen-dataset -P /usr/local/bin
1717
```
1818
* Mark Executable
1919
```sh
@@ -32,18 +32,22 @@ Biasing the distribution this way ensures that each directory has a similar numb
3232
### Usage
3333
```
3434
usage:
35-
gen-dataset -d -b -c [-s -w -t] [path]
35+
gen-dataset -c [-b -d -s -t -w -y] [path]
3636
3737
flags:
38-
-d, --depth <int> - number of directory levels
3938
-b, --branches <int> - number of subdirectories per directory
4039
-c, --count <int> - total number of files to create
40+
-d, --depth <int> - number of directory levels
4141
-s, --size <float [K..T][i]B> - file size
42-
-w, --max-wait <float (seconds)> - max random wait between file creation
4342
-t, --threads <int> - number of parallel file creation threads
43+
-w, --max-wait <float (seconds)> - max random wait between file creation
4444
-y, --yes - don't prompt before creating files
4545
```
4646
#### Example
47+
Generate 10 1GiB files in a single subdirectory named 'subdir':
48+
```sh
49+
gen-dataset -c 10 -s 1GiB subdir
50+
```
4751
Generate 10,000 1M files in 3905 directories:
4852
```sh
4953
gen-dataset -d 5 -b 5 -c 10000 -s 1MiB

src/impl/getopts.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ static void usage(void){
3232
std::cout <<
3333
"gen-dataset Copyright (C) 2021 Josh Boudreau <jboudreau@45drives.com>\n"
3434
"usage:\n"
35-
" gen-dataset -d -b -c [-s -w -t] [path]\n"
35+
" gen-dataset -c [-b -d -s -t -w -y] [path]\n"
3636
"\n"
3737
"flags:\n"
38-
" -d, --depth <int> - number of directory levels\n"
3938
" -b, --branches <int> - number of subdirectories per directory\n"
4039
" -c, --count <int> - total number of files to create\n"
40+
" -d, --depth <int> - number of directory levels\n"
4141
" -s, --size <float [K..T][i]B> - file size\n"
42-
" -w, --max-wait <float (seconds)> - max random wait between file creation\n"
4342
" -t, --threads <int> - number of parallel file creation threads\n"
43+
" -w, --max-wait <float (seconds)> - max random wait between file creation\n"
4444
" -y, --yes - don't prompt before creating files\n"
4545
<< std::endl;
4646
}
@@ -90,11 +90,11 @@ static int parse_size(const std::string &arg){
9090

9191
static void check_opts(const Options &opts){
9292
bool errors = false;
93-
if(opts.depth < 1){
93+
if(opts.depth < 0){
9494
std::cerr << "Invalid depth: " << opts.depth << std::endl;
9595
errors = true;
9696
}
97-
if(opts.branches < 1){
97+
if(opts.branches < 0){
9898
std::cerr << "Invalid branches: " << opts.branches << std::endl;
9999
errors = true;
100100
}

src/incl/getopts.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#pragma once
2121

2222
struct Options{
23-
int depth = -1;
24-
int branches = -1;
23+
int depth = 0;
24+
int branches = 0;
2525
long int count = -1;
2626
int size = 0;
2727
int max_wait_ms = 0;

0 commit comments

Comments
 (0)