Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ Generate the project structure.
**Usage:**

```sh
struct generate [-h] [-l LOG] [-c CONFIG_FILE] [-i LOG_FILE] [-s STRUCTURES_PATH] [-n INPUT_STORE] [-d] [--diff] [-v VARS] [-b BACKUP] [-f {overwrite,skip,append,rename,backup}] [-p GLOBAL_SYSTEM_PROMPT] [--non-interactive] [--mappings-file MAPPINGS_FILE] [-o {console,file}] structure_definition base_path
struct generate [-h] [-l LOG] [-c CONFIG_FILE] [-i LOG_FILE] [-s STRUCTURES_PATH] [-n INPUT_STORE] [-d] [--diff] [-v VARS] [-b BACKUP] [-f {overwrite,skip,append,rename,backup}] [-p GLOBAL_SYSTEM_PROMPT] [--non-interactive] [--mappings-file MAPPINGS_FILE] [-o {console,file}] [structure_definition] [base_path]
```

Defaults when omitted:
- structure_definition -> .struct.yaml
- base_path -> .

Example:
```sh
struct generate
```

**Arguments:**

- `structure_definition`: Path to the YAML configuration file.
- `base_path`: Base path where the structure will be created.
- `structure_definition` (optional): Path to the YAML configuration file (default: `.struct.yaml`).
- `base_path` (optional): Base path where the structure will be created (default: `.`).
- `-s STRUCTURES_PATH, --structures-path STRUCTURES_PATH`: Path to structure definitions.
- `-n INPUT_STORE, --input-store INPUT_STORE`: Path to the input store.
- `-d, --dry-run`: Perform a dry run without creating any files or directories.
Expand Down Expand Up @@ -139,6 +148,14 @@ struct init [path]

## Examples

### Using Defaults

Generate with default structure (.struct.yaml) into current directory:

```sh
struct generate
```

### Basic Structure Generation

Generate a structure using a built-in definition:
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ vim structure.yaml # copy the content from the example folder
struct generate structure.yaml .
```

> **Note**: The `file://` protocol is automatically added for `.yaml` files, so `structure.yaml` and `file://structure.yaml` work identically.
> Note: The `file://` protocol is automatically added for `.yaml` files, so `structure.yaml` and `file://structure.yaml` work identically. Additionally, if your file is named `.struct.yaml` in the current directory and you want to generate into the current directory, you can just run `struct generate`.

## Discovering Available Structures

Expand Down
14 changes: 14 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ struct generate <Tab>
# Shows all available structures
```

### Using Defaults

If you have a .struct.yaml in the current directory and want to generate into the current directory, you can simply run:

```sh
struct generate
```

### Simple Example

```sh
Expand All @@ -49,6 +57,12 @@ struct generate my-config.yaml ./output
struct generate file://my-config.yaml ./output
```

Tip: If your config file is named `.struct.yaml` in the current directory and you want to generate into the current directory, you can simply run:

```sh
struct generate
```

### Diff Preview Example

```sh
Expand Down
4 changes: 2 additions & 2 deletions struct_module/commands/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class GenerateCommand(Command):
def __init__(self, parser):
super().__init__(parser)
parser.description = "Generate the project structure from a YAML configuration file"
structure_arg = parser.add_argument('structure_definition', type=str, help='Path to the YAML configuration file')
structure_arg = parser.add_argument('structure_definition', nargs='?', default='.struct.yaml', type=str, help='Path to the YAML configuration file (default: .struct.yaml)')
structure_arg.completer = structures_completer
parser.add_argument('base_path', type=str, help='Base path where the structure will be created')
parser.add_argument('base_path', nargs='?', default='.', type=str, help='Base path where the structure will be created (default: current directory)')
parser.add_argument('-s', '--structures-path', type=str, help='Path to structure definitions')
parser.add_argument('-n', '--input-store', type=str, help='Path to the input store', default='/tmp/struct/input.json')
parser.add_argument('-d', '--dry-run', action='store_true', help='Perform a dry run without creating any files or directories')
Expand Down
Loading