@devaloop/devalang 0.0.1-alpha.8 → 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cargo/config.toml +2 -0
- package/.devalang +10 -4
- package/.github/workflows/ci.yml +103 -0
- package/Cargo.toml +80 -48
- package/README.md +135 -158
- package/docs/CHANGELOG.md +413 -1
- package/docs/CONTRIBUTING.md +101 -0
- package/docs/ROADMAP.md +10 -7
- package/docs/TODO.md +21 -9
- package/examples/automation.deva +42 -0
- package/examples/bank.deva +7 -0
- package/examples/condition.deva +8 -12
- package/examples/duration.deva +9 -0
- package/examples/events.deva +12 -0
- package/examples/function.deva +15 -0
- package/examples/group.deva +3 -3
- package/examples/index.deva +57 -10
- package/examples/loop.deva +7 -12
- package/examples/pattern.deva +8 -0
- package/examples/plugin.deva +16 -0
- package/examples/synth.deva +14 -0
- package/examples/variables.deva +2 -2
- package/out-tsc/bin/index.d.ts +2 -0
- package/out-tsc/bin/index.js +51 -7
- package/out-tsc/core/functions/index.d.ts +37 -0
- package/out-tsc/core/functions/index.js +76 -0
- package/out-tsc/core/index.d.ts +6 -0
- package/out-tsc/core/index.js +22 -0
- package/out-tsc/core/types/index.d.ts +4 -0
- package/out-tsc/core/types/index.js +20 -0
- package/out-tsc/core/types/plugin.d.ts +18 -0
- package/out-tsc/core/types/plugin.js +2 -0
- package/out-tsc/core/types/result.d.ts +27 -0
- package/out-tsc/core/types/result.js +2 -0
- package/out-tsc/core/types/statement.d.ts +106 -0
- package/out-tsc/core/types/statement.js +2 -0
- package/out-tsc/core/types/value.d.ts +43 -0
- package/out-tsc/core/types/value.js +2 -0
- package/out-tsc/index.d.ts +7 -0
- package/out-tsc/index.js +42 -1
- package/out-tsc/pkg/devalang_core.d.ts +13 -0
- package/out-tsc/pkg/devalang_core.js +50 -0
- package/out-tsc/pkg/devalang_core_bg.wasm.d.ts +33 -0
- package/out-tsc/scripts/copy-wasm-dts.d.ts +1 -0
- package/out-tsc/scripts/copy-wasm-dts.js +73 -0
- package/out-tsc/scripts/postinstall.d.ts +1 -0
- package/out-tsc/scripts/postinstall.js +83 -0
- package/out-tsc/scripts/version/bump.d.ts +1 -0
- package/out-tsc/scripts/version/fetch.d.ts +1 -0
- package/out-tsc/scripts/version/fetch.js +1 -5
- package/out-tsc/scripts/version/index.d.ts +1 -0
- package/out-tsc/scripts/version/sync.d.ts +1 -0
- package/package.json +28 -7
- package/project-version.json +4 -4
- package/rust/cli/bank/api.rs +122 -0
- package/rust/cli/bank/commands.rs +275 -0
- package/rust/cli/bank/mod.rs +29 -0
- package/rust/cli/build/commands.rs +103 -0
- package/rust/cli/build/mod.rs +2 -0
- package/rust/cli/build/process.rs +146 -0
- package/rust/cli/check/mod.rs +208 -0
- package/rust/cli/discover/commands.rs +253 -0
- package/rust/cli/discover/config.rs +111 -0
- package/rust/cli/discover/fs.rs +19 -0
- package/rust/cli/discover/install.rs +103 -0
- package/rust/cli/discover/metadata.rs +48 -0
- package/rust/cli/discover/mod.rs +5 -0
- package/rust/cli/{init.rs → init/commands.rs} +32 -23
- package/rust/cli/init/mod.rs +1 -0
- package/rust/cli/install/addon.rs +118 -0
- package/rust/cli/install/bank.rs +53 -0
- package/rust/cli/install/commands.rs +35 -0
- package/rust/cli/install/mod.rs +4 -0
- package/rust/cli/install/plugin.rs +61 -0
- package/rust/cli/login/commands.rs +124 -0
- package/rust/cli/login/mod.rs +1 -0
- package/rust/cli/mod.rs +12 -205
- package/rust/cli/parser.rs +314 -0
- package/rust/cli/play/commands.rs +324 -0
- package/rust/cli/play/io.rs +17 -0
- package/rust/cli/play/mod.rs +5 -0
- package/rust/cli/play/process.rs +150 -0
- package/rust/cli/play/realtime.rs +91 -0
- package/rust/cli/play/utils.rs +23 -0
- package/rust/cli/telemetry/commands.rs +22 -0
- package/rust/cli/telemetry/event_creator.rs +80 -0
- package/rust/cli/telemetry/mod.rs +3 -0
- package/rust/cli/telemetry/send.rs +51 -0
- package/rust/cli/{template.rs → template/commands.rs} +69 -57
- package/rust/cli/template/mod.rs +1 -0
- package/rust/cli/update/commands.rs +6 -0
- package/rust/cli/update/mod.rs +1 -0
- package/rust/config/driver.rs +103 -0
- package/rust/config/mod.rs +3 -16
- package/rust/config/ops.rs +26 -0
- package/rust/config/settings.rs +101 -0
- package/rust/core/audio/engine/helpers.rs +170 -0
- package/rust/core/audio/engine/mod.rs +7 -0
- package/rust/core/audio/engine/sample.rs +366 -0
- package/rust/core/audio/engine/synth.rs +325 -0
- package/rust/core/audio/evaluator.rs +310 -31
- package/rust/core/audio/interpreter/arrow_call.rs +311 -0
- package/rust/core/audio/interpreter/automate.rs +18 -0
- package/rust/core/audio/interpreter/call.rs +294 -42
- package/rust/core/audio/interpreter/condition.rs +71 -65
- package/rust/core/audio/interpreter/driver.rs +542 -204
- package/rust/core/audio/interpreter/function.rs +26 -0
- package/rust/core/audio/interpreter/let_.rs +38 -19
- package/rust/core/audio/interpreter/load.rs +19 -18
- package/rust/core/audio/interpreter/loop_.rs +114 -59
- package/rust/core/audio/interpreter/mod.rs +14 -11
- package/rust/core/audio/interpreter/sleep.rs +28 -36
- package/rust/core/audio/interpreter/spawn.rs +252 -65
- package/rust/core/audio/interpreter/tempo.rs +40 -16
- package/rust/core/audio/interpreter/trigger.rs +239 -69
- package/rust/core/audio/loader/mod.rs +1 -1
- package/rust/core/audio/loader/trigger.rs +97 -52
- package/rust/core/audio/mod.rs +7 -6
- package/rust/core/audio/player.rs +70 -54
- package/rust/core/audio/renderer.rs +54 -57
- package/rust/core/audio/special/easing.rs +189 -0
- package/rust/core/audio/special/env.rs +45 -0
- package/rust/core/audio/special/math.rs +134 -0
- package/rust/core/audio/special/mod.rs +9 -0
- package/rust/core/audio/special/modulator.rs +143 -0
- package/rust/core/builder/mod.rs +86 -80
- package/rust/core/debugger/lexer.rs +27 -27
- package/rust/core/debugger/mod.rs +30 -21
- package/rust/core/debugger/module.rs +55 -0
- package/rust/core/debugger/preprocessor.rs +27 -27
- package/rust/core/debugger/store.rs +40 -25
- package/rust/core/error/mod.rs +269 -60
- package/rust/core/lexer/driver.rs +61 -0
- package/rust/core/lexer/handler/arrow.rs +82 -0
- package/rust/core/lexer/handler/at.rs +21 -21
- package/rust/core/lexer/handler/brace.rs +41 -41
- package/rust/core/lexer/handler/colon.rs +21 -21
- package/rust/core/lexer/handler/comment.rs +30 -30
- package/rust/core/lexer/handler/dot.rs +21 -21
- package/rust/core/lexer/handler/driver.rs +337 -215
- package/rust/core/lexer/handler/identifier.rs +47 -40
- package/rust/core/lexer/handler/indent.rs +66 -52
- package/rust/core/lexer/handler/mod.rs +15 -13
- package/rust/core/lexer/handler/newline.rs +23 -23
- package/rust/core/lexer/handler/number.rs +31 -31
- package/rust/core/lexer/handler/operator.rs +46 -44
- package/rust/core/lexer/handler/parenthesis.rs +41 -0
- package/rust/core/lexer/handler/slash.rs +21 -0
- package/rust/core/lexer/handler/string.rs +63 -63
- package/rust/core/lexer/mod.rs +3 -30
- package/rust/core/lexer/token.rs +21 -12
- package/rust/core/mod.rs +10 -10
- package/rust/core/parser/driver.rs +584 -312
- package/rust/core/parser/handler/arrow_call.rs +253 -0
- package/rust/core/parser/handler/at.rs +279 -162
- package/rust/core/parser/handler/bank.rs +104 -41
- package/rust/core/parser/handler/condition.rs +83 -74
- package/rust/core/parser/handler/dot.rs +148 -112
- package/rust/core/parser/handler/identifier/automate.rs +254 -0
- package/rust/core/parser/handler/identifier/call.rs +91 -0
- package/rust/core/parser/handler/identifier/emit.rs +70 -0
- package/rust/core/parser/handler/identifier/function.rs +113 -0
- package/rust/core/parser/handler/identifier/group.rs +89 -0
- package/rust/core/parser/handler/identifier/let_.rs +173 -0
- package/rust/core/parser/handler/identifier/mod.rs +55 -0
- package/rust/core/parser/handler/identifier/on.rs +107 -0
- package/rust/core/parser/handler/identifier/print.rs +49 -0
- package/rust/core/parser/handler/identifier/sleep.rs +43 -0
- package/rust/core/parser/handler/identifier/spawn.rs +91 -0
- package/rust/core/parser/handler/identifier/synth.rs +135 -0
- package/rust/core/parser/handler/loop_.rs +194 -66
- package/rust/core/parser/handler/mod.rs +9 -7
- package/rust/core/parser/handler/pattern.rs +74 -0
- package/rust/core/parser/handler/tempo.rs +57 -47
- package/rust/core/parser/mod.rs +3 -4
- package/rust/core/parser/statement.rs +11 -88
- package/rust/core/plugin/loader.rs +137 -0
- package/rust/core/plugin/mod.rs +2 -0
- package/rust/core/plugin/runner.rs +347 -0
- package/rust/core/preprocessor/loader.rs +637 -179
- package/rust/core/preprocessor/mod.rs +4 -4
- package/rust/core/preprocessor/module.rs +60 -53
- package/rust/core/preprocessor/processor.rs +114 -67
- package/rust/core/preprocessor/resolver/bank.rs +49 -47
- package/rust/core/preprocessor/resolver/call.rs +124 -53
- package/rust/core/preprocessor/resolver/condition.rs +95 -66
- package/rust/core/preprocessor/resolver/driver.rs +324 -182
- package/rust/core/preprocessor/resolver/function.rs +69 -0
- package/rust/core/preprocessor/resolver/group.rs +94 -118
- package/rust/core/preprocessor/resolver/let_.rs +32 -0
- package/rust/core/preprocessor/resolver/loop_.rs +318 -145
- package/rust/core/preprocessor/resolver/mod.rs +16 -10
- package/rust/core/preprocessor/resolver/pattern.rs +83 -0
- package/rust/core/preprocessor/resolver/spawn.rs +99 -53
- package/rust/core/preprocessor/resolver/synth.rs +54 -0
- package/rust/core/preprocessor/resolver/tempo.rs +48 -49
- package/rust/core/preprocessor/resolver/trigger.rs +116 -111
- package/rust/core/preprocessor/resolver/value.rs +176 -0
- package/rust/core/store/export.rs +28 -28
- package/rust/core/store/function.rs +40 -0
- package/rust/core/store/global.rs +61 -39
- package/rust/core/store/import.rs +28 -28
- package/rust/core/store/mod.rs +5 -4
- package/rust/core/store/variable.rs +51 -28
- package/rust/core/utils/mod.rs +1 -2
- package/rust/core/utils/path.rs +37 -46
- package/rust/lib.rs +308 -117
- package/rust/main.rs +364 -65
- package/rust/types/Cargo.toml +11 -0
- package/rust/types/src/addons.rs +55 -0
- package/rust/types/src/ast.rs +202 -0
- package/rust/types/src/config.rs +74 -0
- package/rust/types/src/lib.rs +12 -0
- package/rust/types/src/telemetry.rs +85 -0
- package/rust/utils/Cargo.toml +26 -0
- package/rust/utils/src/error.rs +186 -0
- package/rust/utils/src/file.rs +94 -0
- package/rust/utils/src/first_usage.rs +97 -0
- package/rust/utils/{mod.rs → src/lib.rs} +9 -6
- package/rust/utils/{logger.rs → src/logger.rs} +200 -123
- package/rust/utils/src/path.rs +88 -0
- package/rust/utils/src/signature.rs +41 -0
- package/rust/utils/{spinner.rs → src/spinner.rs} +20 -21
- package/rust/utils/src/version.rs +27 -0
- package/rust/utils/{watcher.rs → src/watcher.rs} +46 -33
- package/rust/web/api.rs +5 -0
- package/rust/web/cdn.rs +34 -0
- package/rust/web/mod.rs +3 -0
- package/rust/web/sso.rs +5 -0
- package/templates/minimal/README.md +143 -127
- package/templates/welcome/README.md +143 -127
- package/templates/welcome/src/index.deva +56 -8
- package/templates/welcome/src/variables.deva +2 -4
- package/tests/integration.rs +21 -0
- package/tests/rust/cli_check_build.rs +21 -0
- package/tests/rust/cli_help.rs +12 -0
- package/tests/rust/cli_template_list.rs +10 -0
- package/tests/rust/cli_version.rs +11 -0
- package/tests/typescript/index.spec.ts +136 -0
- package/tests/typescript/playhead.spec.ts +36 -0
- package/tests/typescript/render_e2e.spec.ts +77 -0
- package/tsconfig.json +12 -10
- package/typescript/bin/index.ts +19 -5
- package/typescript/core/functions/index.ts +83 -0
- package/typescript/core/index.ts +6 -0
- package/typescript/core/types/index.ts +4 -0
- package/typescript/core/types/plugin.ts +19 -0
- package/typescript/core/types/result.ts +29 -0
- package/typescript/core/types/statement.ts +47 -0
- package/typescript/core/types/value.ts +29 -0
- package/typescript/index.ts +8 -1
- package/typescript/pkg/devalang_core.d.ts +4 -0
- package/typescript/pkg/devalang_core.ts +49 -0
- package/typescript/scripts/copy-wasm-dts.ts +41 -0
- package/typescript/scripts/postinstall.ts +85 -0
- package/typescript/scripts/version/bump.ts +0 -1
- package/typescript/scripts/version/fetch.ts +1 -6
- package/typescript/scripts/version/index.ts +0 -1
- package/docs/COMMANDS.md +0 -85
- package/docs/CONFIG.md +0 -30
- package/docs/SYNTAX.md +0 -210
- package/out-tsc/bin/devalang.exe +0 -0
- package/out-tsc/scripts/postbuild.js +0 -11
- package/rust/cli/build.rs +0 -137
- package/rust/cli/check.rs +0 -117
- package/rust/cli/play.rs +0 -193
- package/rust/config/loader.rs +0 -13
- package/rust/core/audio/engine.rs +0 -126
- package/rust/core/parser/handler/identifier.rs +0 -262
- package/rust/core/shared/duration.rs +0 -8
- package/rust/core/shared/mod.rs +0 -2
- package/rust/core/shared/value.rs +0 -18
- package/rust/core/utils/validation.rs +0 -35
- package/rust/utils/file.rs +0 -35
- package/rust/utils/signature.rs +0 -17
- package/rust/utils/version.rs +0 -15
- package/typescript/scripts/postbuild.ts +0 -8
package/rust/cli/mod.rs
CHANGED
|
@@ -1,205 +1,12 @@
|
|
|
1
|
-
pub mod
|
|
2
|
-
pub mod build;
|
|
3
|
-
pub mod
|
|
4
|
-
pub mod
|
|
5
|
-
pub mod
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#[command(version = get_version())]
|
|
14
|
-
#[command(about = "🦊 Devalang – A programming language for music and sound.")]
|
|
15
|
-
pub struct Cli {
|
|
16
|
-
#[arg(long, global = true)]
|
|
17
|
-
/// Skips loading the configuration file.
|
|
18
|
-
pub no_config: bool,
|
|
19
|
-
|
|
20
|
-
#[command(subcommand)]
|
|
21
|
-
pub command: Commands,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#[derive(Subcommand)]
|
|
25
|
-
pub enum TemplateCommand {
|
|
26
|
-
/// Lists all available templates for Devalang projects.
|
|
27
|
-
List,
|
|
28
|
-
/// Displays information about a specific template.
|
|
29
|
-
Info {
|
|
30
|
-
name: String,
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
#[derive(Subcommand)]
|
|
35
|
-
pub enum Commands {
|
|
36
|
-
/// Create a new Devalang project.
|
|
37
|
-
///
|
|
38
|
-
/// ### Arguments
|
|
39
|
-
/// - `name` - The name of the project to create.
|
|
40
|
-
/// - `template` - The template to use for the project. Defaults to "default".
|
|
41
|
-
///
|
|
42
|
-
/// ### Example
|
|
43
|
-
/// ```bash
|
|
44
|
-
/// devalang init --name my_project --template default
|
|
45
|
-
///
|
|
46
|
-
Init {
|
|
47
|
-
#[arg(short, long)]
|
|
48
|
-
/// The optional name (directory) of the project to create.
|
|
49
|
-
name: Option<String>,
|
|
50
|
-
|
|
51
|
-
#[arg(short, long)]
|
|
52
|
-
/// The template to use for the project.
|
|
53
|
-
///
|
|
54
|
-
/// ### Default value
|
|
55
|
-
/// - `default`
|
|
56
|
-
///
|
|
57
|
-
template: Option<String>,
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
Template {
|
|
61
|
-
#[command(subcommand)]
|
|
62
|
-
/// The template command to execute.
|
|
63
|
-
command: TemplateCommand,
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
/// Build the program and generate output files.
|
|
67
|
-
///
|
|
68
|
-
/// ### Arguments
|
|
69
|
-
/// - `entry` - The entry point of the program to build. Defaults to "./src".
|
|
70
|
-
/// - `output` - The directory where the output files will be generated. Defaults to "./output".
|
|
71
|
-
/// - `watch` - Whether to watch for changes and rebuild. Defaults to "true".
|
|
72
|
-
///
|
|
73
|
-
/// ### Example
|
|
74
|
-
/// ```bash
|
|
75
|
-
/// devalang build --entry ./src --output ./output --watch true
|
|
76
|
-
/// ```
|
|
77
|
-
///
|
|
78
|
-
Build {
|
|
79
|
-
#[arg(short, long)]
|
|
80
|
-
/// The entry point of the program to build.
|
|
81
|
-
///
|
|
82
|
-
entry: Option<String>,
|
|
83
|
-
|
|
84
|
-
#[arg(short, long)]
|
|
85
|
-
/// The directory where the output files will be generated.
|
|
86
|
-
///
|
|
87
|
-
output: Option<String>,
|
|
88
|
-
|
|
89
|
-
#[arg(long, default_value_t = false)]
|
|
90
|
-
/// Whether to watch for changes and rebuild.
|
|
91
|
-
///
|
|
92
|
-
/// ### Default value
|
|
93
|
-
/// - `false`
|
|
94
|
-
///
|
|
95
|
-
watch: bool,
|
|
96
|
-
|
|
97
|
-
#[arg(long, default_value = "real-time")]
|
|
98
|
-
/// The mode of compilation.
|
|
99
|
-
///
|
|
100
|
-
/// ### Default value
|
|
101
|
-
/// - `real-time`
|
|
102
|
-
///
|
|
103
|
-
/// ### Possible values
|
|
104
|
-
/// - `real-time` - Compiles files as soon as possible.
|
|
105
|
-
/// - `batch` - Compiles files one by one.
|
|
106
|
-
/// - `check` - Analyzes the code without compiling it.
|
|
107
|
-
///
|
|
108
|
-
compilation_mode: String,
|
|
109
|
-
|
|
110
|
-
#[arg(short, long, default_value_t = false)]
|
|
111
|
-
/// Whether to print debug information.
|
|
112
|
-
///
|
|
113
|
-
/// ### Default value
|
|
114
|
-
/// - `false`
|
|
115
|
-
///
|
|
116
|
-
debug: bool,
|
|
117
|
-
|
|
118
|
-
#[arg(short, long, default_value_t = false)]
|
|
119
|
-
/// Whether to compress the output files.
|
|
120
|
-
///
|
|
121
|
-
/// ### Default value
|
|
122
|
-
/// - `false`
|
|
123
|
-
///
|
|
124
|
-
compress: bool,
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
/// Analyze the program for errors and warnings.
|
|
128
|
-
///
|
|
129
|
-
/// ### Arguments
|
|
130
|
-
/// - `entry` - The entry point of the program to analyze. Defaults to "./src".
|
|
131
|
-
/// - `watch` - Whether to watch for changes and re-analyze. Defaults to "true".
|
|
132
|
-
///
|
|
133
|
-
/// ### Example
|
|
134
|
-
/// ```bash
|
|
135
|
-
/// devalang check --entry ./src --watch true --compilation-mode real-time
|
|
136
|
-
/// ```
|
|
137
|
-
Check {
|
|
138
|
-
#[arg(short, long)]
|
|
139
|
-
/// The entry point of the program to analyze.
|
|
140
|
-
///
|
|
141
|
-
entry: Option<String>,
|
|
142
|
-
|
|
143
|
-
#[arg(short, long)]
|
|
144
|
-
/// The directory where the output files will be generated.
|
|
145
|
-
///
|
|
146
|
-
output: Option<String>,
|
|
147
|
-
|
|
148
|
-
#[arg(long, default_value_t = false)]
|
|
149
|
-
/// Whether to watch for changes and re-analyze.
|
|
150
|
-
///
|
|
151
|
-
/// ### Default value
|
|
152
|
-
/// - `false`
|
|
153
|
-
///
|
|
154
|
-
watch: bool,
|
|
155
|
-
|
|
156
|
-
#[arg(short, long, default_value = "real-time")]
|
|
157
|
-
/// The mode of compilation.
|
|
158
|
-
///
|
|
159
|
-
/// ### Default value
|
|
160
|
-
/// - `real-time`
|
|
161
|
-
///
|
|
162
|
-
/// ### Possible values
|
|
163
|
-
/// - `real-time` - Analyzes files as soon as possible.
|
|
164
|
-
/// - `batch` - Analyzes files one by one.
|
|
165
|
-
/// - `check` - Analyzes the code without compiling it.
|
|
166
|
-
///
|
|
167
|
-
compilation_mode: String,
|
|
168
|
-
|
|
169
|
-
#[arg(short, long, default_value_t = false)]
|
|
170
|
-
/// Whether to print debug information.
|
|
171
|
-
///
|
|
172
|
-
/// ### Default value
|
|
173
|
-
/// - `false`
|
|
174
|
-
///
|
|
175
|
-
debug: bool,
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
Play {
|
|
179
|
-
#[arg(short, long)]
|
|
180
|
-
/// The entry point of the program to play.
|
|
181
|
-
///
|
|
182
|
-
entry: Option<String>,
|
|
183
|
-
|
|
184
|
-
#[arg(short, long)]
|
|
185
|
-
/// The directory where the output files will be generated.
|
|
186
|
-
///
|
|
187
|
-
output: Option<String>,
|
|
188
|
-
|
|
189
|
-
#[arg(long, default_value_t = false)]
|
|
190
|
-
/// Whether to watch for changes and re-play.
|
|
191
|
-
///
|
|
192
|
-
/// ### Default value
|
|
193
|
-
/// - `false`
|
|
194
|
-
///
|
|
195
|
-
watch: bool,
|
|
196
|
-
|
|
197
|
-
#[arg(long, default_value_t = false)]
|
|
198
|
-
/// Whether to replay the program after it finishes.
|
|
199
|
-
///
|
|
200
|
-
/// ### Default value
|
|
201
|
-
/// - `false`
|
|
202
|
-
///
|
|
203
|
-
repeat: bool,
|
|
204
|
-
},
|
|
205
|
-
}
|
|
1
|
+
pub mod bank;
|
|
2
|
+
pub mod build;
|
|
3
|
+
pub mod check;
|
|
4
|
+
pub mod discover;
|
|
5
|
+
pub mod init;
|
|
6
|
+
pub mod install;
|
|
7
|
+
pub mod login;
|
|
8
|
+
pub mod parser;
|
|
9
|
+
pub mod play;
|
|
10
|
+
pub mod telemetry;
|
|
11
|
+
pub mod template;
|
|
12
|
+
pub mod update;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
use clap::{Parser, Subcommand};
|
|
2
|
+
|
|
3
|
+
#[derive(Parser)]
|
|
4
|
+
#[command(name = "devalang")]
|
|
5
|
+
#[command(author = "Devaloop")]
|
|
6
|
+
#[command(about = "🦊 Devalang – A programming language for music and sound.")]
|
|
7
|
+
pub struct Cli {
|
|
8
|
+
#[arg(long, global = true)]
|
|
9
|
+
/// Skips loading the configuration file.
|
|
10
|
+
pub no_config: bool,
|
|
11
|
+
|
|
12
|
+
#[command(subcommand)]
|
|
13
|
+
pub command: Commands,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[derive(Subcommand)]
|
|
17
|
+
pub enum TelemetryCommand {
|
|
18
|
+
/// Enables telemetry data collection.
|
|
19
|
+
Enable {},
|
|
20
|
+
/// Disables telemetry data collection.
|
|
21
|
+
Disable {},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#[derive(Subcommand)]
|
|
25
|
+
pub enum InstallCommand {
|
|
26
|
+
/// Installs a template.
|
|
27
|
+
Template { name: String },
|
|
28
|
+
/// Installs a bank.
|
|
29
|
+
Bank { name: String },
|
|
30
|
+
/// Installs a plugin.
|
|
31
|
+
Plugin { name: String },
|
|
32
|
+
/// Installs a preset.
|
|
33
|
+
Preset { name: String },
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#[derive(Subcommand)]
|
|
37
|
+
pub enum TemplateCommand {
|
|
38
|
+
/// Lists all available templates for Devalang projects.
|
|
39
|
+
List,
|
|
40
|
+
/// Displays information about a specific template.
|
|
41
|
+
Info { name: String },
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[derive(Subcommand)]
|
|
45
|
+
pub enum BankCommand {
|
|
46
|
+
/// Lists installed banks.
|
|
47
|
+
List,
|
|
48
|
+
/// Lists all available banks.
|
|
49
|
+
Available,
|
|
50
|
+
/// Displays information about a specific bank.
|
|
51
|
+
Info { name: String },
|
|
52
|
+
/// Removes a bank.
|
|
53
|
+
Remove { name: String },
|
|
54
|
+
/// Updates a specific or all banks.
|
|
55
|
+
Update { name: Option<String> },
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#[derive(Subcommand)]
|
|
59
|
+
pub enum Commands {
|
|
60
|
+
/// Create a new Devalang project.
|
|
61
|
+
///
|
|
62
|
+
/// ### Arguments
|
|
63
|
+
/// - `name` - The name of the project to create.
|
|
64
|
+
/// - `template` - The template to use for the project. Defaults to "default".
|
|
65
|
+
///
|
|
66
|
+
/// ### Example
|
|
67
|
+
/// ```bash
|
|
68
|
+
/// devalang init --name my_project --template default
|
|
69
|
+
///
|
|
70
|
+
Init {
|
|
71
|
+
#[arg(short, long)]
|
|
72
|
+
/// The optional name (directory) of the project to create.
|
|
73
|
+
name: Option<String>,
|
|
74
|
+
|
|
75
|
+
#[arg(short, long)]
|
|
76
|
+
/// The template to use for the project.
|
|
77
|
+
///
|
|
78
|
+
/// ### Default value
|
|
79
|
+
/// - `default`
|
|
80
|
+
///
|
|
81
|
+
template: Option<String>,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/// Manage templates for Devalang projects.
|
|
85
|
+
///
|
|
86
|
+
/// ### Subcommands
|
|
87
|
+
/// - `list` - Lists all available templates.
|
|
88
|
+
/// - `info <name>` - Displays information about a specific template.
|
|
89
|
+
///
|
|
90
|
+
/// ### Example
|
|
91
|
+
/// ```bash
|
|
92
|
+
/// devalang template list
|
|
93
|
+
/// devalang template info my_template
|
|
94
|
+
/// ```bash
|
|
95
|
+
///
|
|
96
|
+
Template {
|
|
97
|
+
#[command(subcommand)]
|
|
98
|
+
/// The template command to execute.
|
|
99
|
+
command: TemplateCommand,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/// Build the program and generate output files.
|
|
103
|
+
///
|
|
104
|
+
/// ### Arguments
|
|
105
|
+
/// - `entry` - The entry point of the program to build. Defaults to "./src".
|
|
106
|
+
/// - `output` - The directory where the output files will be generated. Defaults to "./output".
|
|
107
|
+
/// - `watch` - Whether to watch for changes and rebuild. Defaults to "true".
|
|
108
|
+
/// - `debug` - Whether to print debug information. Defaults to "false".
|
|
109
|
+
/// - `compress` - Whether to compress the output files. Defaults to "false".
|
|
110
|
+
///
|
|
111
|
+
/// ### Example
|
|
112
|
+
/// ```bash
|
|
113
|
+
/// devalang build --entry ./src --output ./output --watch true --debug false --compress false
|
|
114
|
+
/// ```
|
|
115
|
+
///
|
|
116
|
+
Build {
|
|
117
|
+
#[arg(short, long)]
|
|
118
|
+
/// The entry point of the program to build.
|
|
119
|
+
///
|
|
120
|
+
entry: Option<String>,
|
|
121
|
+
|
|
122
|
+
#[arg(short, long)]
|
|
123
|
+
/// The directory where the output files will be generated.
|
|
124
|
+
///
|
|
125
|
+
output: Option<String>,
|
|
126
|
+
|
|
127
|
+
#[arg(long, default_value_t = false)]
|
|
128
|
+
/// Whether to watch for changes and rebuild.
|
|
129
|
+
///
|
|
130
|
+
/// ### Default value
|
|
131
|
+
/// - `false`
|
|
132
|
+
///
|
|
133
|
+
watch: bool,
|
|
134
|
+
|
|
135
|
+
#[arg(short, long, default_value_t = false)]
|
|
136
|
+
/// Whether to print debug information.
|
|
137
|
+
///
|
|
138
|
+
/// ### Default value
|
|
139
|
+
/// - `false`
|
|
140
|
+
///
|
|
141
|
+
debug: bool,
|
|
142
|
+
|
|
143
|
+
#[arg(short, long, default_value_t = false)]
|
|
144
|
+
/// Whether to compress the output files.
|
|
145
|
+
///
|
|
146
|
+
/// ### Default value
|
|
147
|
+
/// - `false`
|
|
148
|
+
///
|
|
149
|
+
compress: bool,
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
/// Analyze the program for errors and warnings.
|
|
153
|
+
///
|
|
154
|
+
/// ### Arguments
|
|
155
|
+
/// - `entry` - The entry point of the program to analyze. Defaults to "./src".
|
|
156
|
+
/// - `output` - The directory where the output files will be generated. Defaults to "./output".
|
|
157
|
+
/// - `watch` - Whether to watch for changes and re-analyze. Defaults to "true".
|
|
158
|
+
/// - `debug` - Whether to print debug information. Defaults to "false".
|
|
159
|
+
///
|
|
160
|
+
/// ### Example
|
|
161
|
+
/// ```bash
|
|
162
|
+
/// devalang check --entry ./src --output ./output --watch true --debug false
|
|
163
|
+
/// ```
|
|
164
|
+
///
|
|
165
|
+
Check {
|
|
166
|
+
#[arg(short, long)]
|
|
167
|
+
/// The entry point of the program to analyze.
|
|
168
|
+
entry: Option<String>,
|
|
169
|
+
|
|
170
|
+
#[arg(short, long)]
|
|
171
|
+
/// The directory where the output files will be generated.
|
|
172
|
+
output: Option<String>,
|
|
173
|
+
|
|
174
|
+
#[arg(long, default_value_t = false)]
|
|
175
|
+
/// Whether to watch for changes and re-analyze.
|
|
176
|
+
///
|
|
177
|
+
/// ### Default value
|
|
178
|
+
/// - `false`
|
|
179
|
+
///
|
|
180
|
+
watch: bool,
|
|
181
|
+
|
|
182
|
+
#[arg(short, long, default_value_t = false)]
|
|
183
|
+
/// Whether to print debug information.
|
|
184
|
+
///
|
|
185
|
+
/// ### Default value
|
|
186
|
+
/// - `false`
|
|
187
|
+
///
|
|
188
|
+
debug: bool,
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
/// Play the program and generate output files.
|
|
192
|
+
///
|
|
193
|
+
/// ### Arguments
|
|
194
|
+
/// - `entry` - The entry point of the program to play. Defaults to "./src".
|
|
195
|
+
/// - `output` - The directory where the output files will be generated. Defaults to "./output".
|
|
196
|
+
/// - `watch` - Whether to watch for changes and re-play. Defaults to "false".
|
|
197
|
+
/// - `repeat` - Whether to replay the program after it finishes. Defaults to "false".
|
|
198
|
+
/// - `debug` - Whether to print debug information. Defaults to "false".
|
|
199
|
+
///
|
|
200
|
+
/// Note: `--repeat` and `--watch` cannot be used together. Instead use `repeat` to watch for changes and replay the program.
|
|
201
|
+
///
|
|
202
|
+
/// ### Example
|
|
203
|
+
/// ```bash
|
|
204
|
+
/// devalang play --entry ./src --output ./output --repeat true --debug false
|
|
205
|
+
/// ```
|
|
206
|
+
///
|
|
207
|
+
Play {
|
|
208
|
+
#[arg(short, long)]
|
|
209
|
+
/// The entry point of the program to play.
|
|
210
|
+
entry: Option<String>,
|
|
211
|
+
|
|
212
|
+
#[arg(short, long)]
|
|
213
|
+
/// The directory where the output files will be generated.
|
|
214
|
+
output: Option<String>,
|
|
215
|
+
|
|
216
|
+
#[arg(long, default_value_t = false)]
|
|
217
|
+
/// Whether to watch for changes and re-play.
|
|
218
|
+
///
|
|
219
|
+
/// ### Default value
|
|
220
|
+
/// - `false`
|
|
221
|
+
///
|
|
222
|
+
watch: bool,
|
|
223
|
+
|
|
224
|
+
#[arg(long, default_value_t = false)]
|
|
225
|
+
/// Whether to replay the program after it finishes.
|
|
226
|
+
///
|
|
227
|
+
/// ### Default value
|
|
228
|
+
/// - `false`
|
|
229
|
+
///
|
|
230
|
+
repeat: bool,
|
|
231
|
+
|
|
232
|
+
#[arg(short, long, default_value_t = false)]
|
|
233
|
+
/// Whether to print debug information.
|
|
234
|
+
///
|
|
235
|
+
/// ### Default value
|
|
236
|
+
/// - `false`
|
|
237
|
+
///
|
|
238
|
+
debug: bool,
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
/// Update the Devalang CLI to the latest version.
|
|
242
|
+
///
|
|
243
|
+
/// ### Arguments
|
|
244
|
+
/// - `only` - Selects what to update (separated by commas). Defaults to updating all components.
|
|
245
|
+
///
|
|
246
|
+
Update {
|
|
247
|
+
// #[arg(long, default_value_t = false)]
|
|
248
|
+
/// Whether to allow updates when the working directory is dirty.
|
|
249
|
+
// allow_dirty: bool,
|
|
250
|
+
|
|
251
|
+
#[arg(long, default_value = "")]
|
|
252
|
+
/// Selects what to update (separated by commas).
|
|
253
|
+
only: Option<String>,
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
/// Install templates, banks, or plugins.
|
|
257
|
+
///
|
|
258
|
+
/// ### Subcommands
|
|
259
|
+
/// - `template` - Installs a template.
|
|
260
|
+
/// - `bank` - Installs a bank.
|
|
261
|
+
/// - `plugin` - Installs a plugin.
|
|
262
|
+
/// - `preset` - Installs a preset.
|
|
263
|
+
///
|
|
264
|
+
Install {
|
|
265
|
+
#[command(subcommand)]
|
|
266
|
+
command: InstallCommand,
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
/// Discover available local addons for Devalang.
|
|
270
|
+
///
|
|
271
|
+
Discover {},
|
|
272
|
+
|
|
273
|
+
/// Manage banks for Devalang projects.
|
|
274
|
+
///
|
|
275
|
+
/// ### Subcommands
|
|
276
|
+
/// - `list` - Lists all available banks.
|
|
277
|
+
/// - `info <name>` - Displays information about a specific bank.
|
|
278
|
+
///
|
|
279
|
+
Bank {
|
|
280
|
+
#[command(subcommand)]
|
|
281
|
+
command: BankCommand,
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
/// Telemetry settings for Devalang.
|
|
285
|
+
///
|
|
286
|
+
/// ### Subcommands
|
|
287
|
+
/// - `enable` - Enables telemetry data collection.
|
|
288
|
+
/// - `disable` - Disables telemetry data collection.
|
|
289
|
+
///
|
|
290
|
+
Telemetry {
|
|
291
|
+
#[command(subcommand)]
|
|
292
|
+
command: TelemetryCommand,
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
/// Generate addon scaffolding for Devalang.
|
|
296
|
+
///
|
|
297
|
+
/// ### Subcommands
|
|
298
|
+
/// - `bank` - Generates a bank scaffold.
|
|
299
|
+
/// - `plugin` - Generates a plugin scaffold.
|
|
300
|
+
/// - `preset` - Generates a preset scaffold.
|
|
301
|
+
///
|
|
302
|
+
// Scaffold {
|
|
303
|
+
// #[command(subcommand)]
|
|
304
|
+
// command: ScaffoldCommand,
|
|
305
|
+
// },
|
|
306
|
+
|
|
307
|
+
/// Log in to your Devaloop account.
|
|
308
|
+
///
|
|
309
|
+
Login {},
|
|
310
|
+
|
|
311
|
+
/// Log out of your Devaloop account.
|
|
312
|
+
///
|
|
313
|
+
Logout {},
|
|
314
|
+
}
|