Skip to content

Commit

Permalink
add usage exapmles (#17)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruslan Semagin <[email protected]>
  • Loading branch information
pixel365 authored Feb 18, 2025
1 parent 116ea49 commit 9e59f36
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 2 deletions.
75 changes: 74 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,80 @@ The installation process will be described later, as the project is still under

### Usage

Usage examples will be added in the future.
```shell
# Create a new module (default config)
bx create --name my_module
```

```shell
# Check the configuration of a module by name
bx check --name my_module


# Check the configuration of a module by file path
bx check -f module-path/config.yaml
```

```shell
# Build a module by name
bx build --name my_module

# Build a module by file path
bx build -f config.yaml

# Override version
bx build --name my_module --version 1.2.3
```

### Example of default module configuration

```yaml
name: test # The name of the project or build.
version: 1.0.0 # The version of the project or build.
account: test # The account associated with the project.
repository: "" # The repository URL where the project is stored (can be empty if not specified).
buildDirectory: "./dist" # Directory where the build artifacts will be output.
logDirectory: "./logs" # Directory where log files will be stored.

mapping:
- name: "components" # Name of the mapping, describing what the mapping represents (e.g., components).
# This can be any name that makes sense for your project, used for your own convenience.
relativePath: "install/components" # Relative path in the project to map files to.
ifFileExists: "replace" # Action to take if the file already exists (options: replace, skip, copy-new).
paths:
- ./examples/structure/bitrix/components # List of paths to files that will be mapped.
- ./examples/structure/local/components

- name: "templates"
relativePath: "install/templates"
ifFileExists: "replace"
paths:
- ./examples/structure/bitrix/templates
- ./examples/structure/local/templates

- name: "rootFiles"
relativePath: "."
ifFileExists: "replace"
paths:
- ./examples/structure/simple-file.php

- name: "testFiles"
relativePath: "test"
ifFileExists: "replace"
paths:
- ./examples/structure/simple-file.php

- name: "some name"
relativePath: "some path"
ifFileExists: "skip"
paths:
- some-directory
- some-filepath
- etc.

ignore:
- "**/*.log" # List of files or patterns to ignore during the build or processing (e.g., log files).
```
### Status
Expand Down
10 changes: 10 additions & 0 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ func newBuildCommand() *cobra.Command {
Use: "build",
Aliases: []string{"b"},
Short: "Build a module",
Example: `
# Build a module by name
bx build --name my_module
# Build a module by file path
bx build -f config.yaml
# Override version
bx build --name my_module --version 1.2.3
`,
RunE: func(cmd *cobra.Command, args []string) error {
return build(cmd, args)
},
Expand Down
10 changes: 9 additions & 1 deletion cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ import (
func newCheckCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "check",
Short: "Check a module",
Short: "Check the configuration of a module",
Example: `
# Check the configuration of a module by name
bx check --name my_module
# Check the configuration of a module by file path
bx check -f module-path/config.yaml
`,
RunE: func(cmd *cobra.Command, args []string) error {
return check(cmd, args)
},
Expand Down
4 changes: 4 additions & 0 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ func newCreateCommand() *cobra.Command {
Use: "create",
Aliases: []string{"c"},
Short: "Create a new module",
Example: `
# Create a new module
bx create --name my_module
`,
RunE: func(cmd *cobra.Command, args []string) error {
return create(cmd, args)
},
Expand Down

0 comments on commit 9e59f36

Please sign in to comment.