You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(adptool): reformat README for improved readability and compliance
- Restructured content to fit within 80-character line limit
- Added blank lines to separate sections and improve readability
- Updated code examples and command syntax for better clarity
- Improved consistency in list formatting and indentation
`adptool` is a powerful and highly configurable Go code generator that automates the creation of adapter code. It helps you seamlessly integrate third-party libraries and internal modules by generating type aliases, function wrappers, and method proxies based on a clear and powerful configuration system.
8
+
`adptool` is a powerful and highly configurable Go code generator that automates the creation of adapter code. It helps
9
+
you seamlessly integrate third-party libraries and internal modules by generating type aliases, function wrappers, and
10
+
method proxies based on a clear and powerful configuration system.
-`[arguments...]` (required): One or more Go source files or directories to scan for directives. Supports `...` wildcard syntax (e.g., `./...`).
115
+
-`[arguments...]` (required): One or more Go source files or directories to scan for directives. Supports `...`
116
+
wildcard syntax (e.g., `./...`).
107
117
108
118
**Flags**
109
119
110
120
-`-c, --config <file_path>`
111
-
- Specifies the path to a configuration file (YAML, JSON, or TOML). If not provided, `adptool` automatically searches for `.adptool.yaml` (or `.json`, `.toml`) in the current directory and a `./configs` subdirectory.
121
+
- Specifies the path to a configuration file (YAML, JSON, or TOML). If not provided, `adptool` automatically
122
+
searches for `.adptool.yaml` (or `.json`, `.toml`) in the current directory and a `./configs` subdirectory.
112
123
113
124
-`--copyright-holder <string>`
114
-
- Injects a copyright notice into the generated file's header.
125
+
- Injects a copyright notice into the generated file's header.
115
126
116
127
-`-o, --output <file_path>` (Planned)
117
-
- Specifies a single file path for all generated output code. Currently, output files are generated automatically alongside their source directive files.
128
+
- Specifies a single file path for all generated output code. Currently, output files are generated automatically
129
+
alongside their source directive files.
118
130
119
131
-`-v, --verbose` (Planned)
120
-
- Enables verbose logging for debugging.
132
+
- Enables verbose logging for debugging.
121
133
122
134
### Directives
123
135
124
136
Directives are comments in your Go source code that `adptool` uses as entry points.
125
137
126
138
-`//go:adapter:package <import_path> [alias]`
127
-
- This is the primary directive. It tells `adptool` to adapt the package specified by `<import_path>`.
128
-
- You can optionally provide a custom `[alias]` for the package in the generated code.
139
+
- This is the primary directive. It tells `adptool` to adapt the package specified by `<import_path>`.
140
+
- You can optionally provide a custom `[alias]` for the package in the generated code.
129
141
130
142
```go
131
143
// Adapt the package, letting the generator create an alias.
@@ -137,7 +149,8 @@ Directives are comments in your Go source code that `adptool` uses as entry poin
137
149
138
150
## Configuration
139
151
140
-
`adptool` is controlled by a configuration file (e.g., `.adptool.yaml`). For fully-commented examples, see the [**`./examples`**](./examples) directory.
152
+
`adptool` is controlled by a configuration file (e.g., `.adptool.yaml`). For fully-commented examples, see the [*
153
+
*`./examples`**](./examples) directory.
141
154
142
155
Here is a high-level overview of the main configuration sections:
143
156
@@ -146,16 +159,17 @@ Here is a high-level overview of the main configuration sections:
146
159
-`defaults`: Sets the default behavior for how rules are applied (e.g., `prepend` or `replace` for prefixes).
147
160
-`props`: A list of key-value pairs that can be used as variables in other parts of the configuration.
148
161
-`packages`: A list of package-specific rules that override the global rules.
149
-
-`types`, `functions`, `variables`, `constants`: These sections contain the core renaming rules for different kinds of Go declarations.
162
+
-`types`, `functions`, `variables`, `constants`: These sections contain the core renaming rules for different kinds of
163
+
Go declarations.
150
164
151
165
### Rule Priority
152
166
153
167
For any given symbol, rules are resolved and applied in the following order:
154
168
155
-
1.**Ignore**: If a symbol matches an `ignores` rule, it is skipped entirely.
156
-
2.**Explicit**: If an `explicit` rule (`from`/`to`) matches the symbol, it is renamed, and **no further rules apply**.
157
-
3.**Prefix & Suffix**: If no explicit rule matches, the resolved `prefix` and `suffix` are applied.
158
-
4.**Regex**: The resolved `regex` rules are applied to the result of the previous step.
169
+
1.**Ignore**: If a symbol matches an `ignores` rule, it is skipped entirely.
170
+
2.**Explicit**: If an `explicit` rule (`from`/`to`) matches the symbol, it is renamed, and **no further rules apply**.
171
+
3.**Prefix & Suffix**: If no explicit rule matches, the resolved `prefix` and `suffix` are applied.
172
+
4.**Regex**: The resolved `regex` rules are applied to the result of the previous step.
0 commit comments