Skip to content

Commit ea419f4

Browse files
Update documentation and comments.
1 parent 7296a51 commit ea419f4

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

cli/src/args.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ pub(crate) fn build_command() -> Command<'static> {
150150
.min_values(1),
151151
).arg(
152152
Arg::new(ARG_TARGET_OS)
153+
.short('t')
153154
.long("target-os")
154155
.help("Optional restrict to target_os")
155156
.takes_value(true)

core/src/target_os_check.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ use quote::ToTokens;
55
use syn::{punctuated::Punctuated, Attribute, Expr, ExprLit, Lit, Meta, Token};
66

77
#[derive(Copy, Clone, Default, Debug)]
8+
/// Scoped inside a block that either accepts
9+
/// or rejects.
810
enum TargetScope {
911
#[default]
1012
Accept,
1113
Reject,
1214
}
1315

1416
#[derive(Default)]
17+
/// An iterator that yeilds all meta items and their contained scope.
1518
struct TargetOsIterator {
1619
meta: Vec<(TargetScope, Meta)>,
1720
}
1821

1922
impl TargetOsIterator {
23+
/// Create a new nested meta iterator.
2024
fn new(meta: Meta) -> Self {
2125
Self {
2226
meta: Vec::from([(TargetScope::Accept, meta)]),

docs/src/usage/configuration.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ The behaviour of Typeshare can be customized by either passing options on the co
77
- `-l`, `--lang`
88
(Required) The language you want your definitions to be generated in. Currently, this option can be set to either `kotlin`, `swift`, `go`, or `typescript`.
99
- `-o`, `--output-file`
10-
(Required) The file path to which the generated definitions will be written.
10+
(Required or -d) The file path to which the generated definitions will be written.
11+
- `-d`, `--directory`
12+
(Required or -o) The folder path to write the multiple module files to.
1113

1214
- `-s`, `--swift-prefix`
13-
Specify a prefix that will be prepended to type names when generating types in Swift.
15+
Specify a prefix that will be prepended to type names when generating types in Swift.
1416

1517
- `-M`, `--module-name`
16-
Specify the name of the Kotlin module for generated Kotlin source code.
18+
Specify the name of the Kotlin module for generated Kotlin source code.
19+
20+
- `-t`, `--target-os`
21+
Optional comma separated list of target os targets. Types that are restricted via `#[cfg(target_os = <target>]`
22+
that do not match the argument list will be filtered out.
1723

1824
- `-j`, `--java-package`
19-
Specify the name of the Java package for generated Kotlin types.
25+
Specify the name of the Java package for generated Kotlin types.
2026

2127
- `-c`, `--config-file`
2228
Instead of searching for a `typeshare.toml` file, this option can be set to specify the path to the configuration file that Typeshare will use.
@@ -54,4 +60,4 @@ In the configuration file, you can specify the options you want to set so that t
5460
In order to create a config file you can run the following command to generate one in your current directory.
5561
```
5662
typeshare -g
57-
```
63+
```

0 commit comments

Comments
 (0)