Skip to content

Commit

Permalink
refactor(core): remove cli feature (#6704)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Apr 14, 2023
1 parent 34b8f33 commit 09376af
Show file tree
Hide file tree
Showing 28 changed files with 172 additions and 1,436 deletions.
7 changes: 7 additions & 0 deletions .changes/move-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"api": patch
"tauri": patch
"tauri-utils": patch
---

Moved the `cli` feature to its own plugin in the plugins-workspace repository.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and

### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)

The code for Tauri Core is located in `[Tauri repo root]/core/tauri`, and the Rust API, Macros, and Utils are in `[Tauri repo root]/core/tauri-(api/macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `yarn tauri build` or `yarn tauri dev` in the helloworld app directory after making changes to test them out. To use your local changes in another project, edit its `src-tauri/Cargo.toml` file so that the `tauri` key looks like `tauri = { path = "PATH", features = [ "api-all", "cli" ] }`, where `PATH` is the relative path to `[Tauri repo root]/core/tauri`. Then, your local copy of the Tauri core packages will be rebuilt and used whenever you build that project.
The code for Tauri Core is located in `[Tauri repo root]/core/tauri`, and the Rust API, Macros, and Utils are in `[Tauri repo root]/core/tauri-(api/macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `yarn tauri build` or `yarn tauri dev` in the helloworld app directory after making changes to test them out. To use your local changes in another project, edit its `src-tauri/Cargo.toml` file so that the `tauri` key looks like `tauri = { path = "PATH", features = [ "api-all" ] }`, where `PATH` is the relative path to `[Tauri repo root]/core/tauri`. Then, your local copy of the Tauri core packages will be rebuilt and used whenever you build that project.

#### Building the documentation locally

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-fmt-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
clippy:
- { args: '', key: 'empty' }
- {
args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart',
args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,updater,system-tray,windows7-compat,http-multipart',
key: 'all'
}
- { args: '--features custom-protocol', key: 'custom-protocol' }
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
key: api-all
}
- {
args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,
args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,updater,system-tray,windows7-compat,http-multipart,
key: all
}

Expand Down
257 changes: 0 additions & 257 deletions core/config-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,6 @@
"$ref": "#/definitions/WindowConfig"
}
},
"cli": {
"description": "The CLI configuration.",
"anyOf": [
{
"$ref": "#/definitions/CliConfig"
},
{
"type": "null"
}
]
},
"bundle": {
"description": "The bundler configuration.",
"default": {
Expand Down Expand Up @@ -778,252 +767,6 @@
}
]
},
"CliConfig": {
"description": "describes a CLI configuration\n\nSee more: https://tauri.app/v1/api/config#cliconfig",
"type": "object",
"properties": {
"description": {
"description": "Command description which will be shown on the help information.",
"type": [
"string",
"null"
]
},
"longDescription": {
"description": "Command long description which will be shown on the help information.",
"type": [
"string",
"null"
]
},
"beforeHelp": {
"description": "Adds additional help information to be displayed in addition to auto-generated help. This information is displayed before the auto-generated help information. This is often used for header information.",
"type": [
"string",
"null"
]
},
"afterHelp": {
"description": "Adds additional help information to be displayed in addition to auto-generated help. This information is displayed after the auto-generated help information. This is often used to describe how to use the arguments, or caveats to be noted.",
"type": [
"string",
"null"
]
},
"args": {
"description": "List of arguments for the command",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/CliArg"
}
},
"subcommands": {
"description": "List of subcommands of this command",
"type": [
"object",
"null"
],
"additionalProperties": {
"$ref": "#/definitions/CliConfig"
}
}
},
"additionalProperties": false
},
"CliArg": {
"description": "A CLI argument definition.",
"type": "object",
"required": [
"name"
],
"properties": {
"short": {
"description": "The short version of the argument, without the preceding -.\n\nNOTE: Any leading `-` characters will be stripped, and only the first non-character will be used as the short version.",
"type": [
"string",
"null"
],
"maxLength": 1,
"minLength": 1
},
"name": {
"description": "The unique argument name",
"type": "string"
},
"description": {
"description": "The argument description which will be shown on the help information. Typically, this is a short (one line) description of the arg.",
"type": [
"string",
"null"
]
},
"longDescription": {
"description": "The argument long description which will be shown on the help information. Typically this a more detailed (multi-line) message that describes the argument.",
"type": [
"string",
"null"
]
},
"takesValue": {
"description": "Specifies that the argument takes a value at run time.\n\nNOTE: values for arguments may be specified in any of the following methods - Using a space such as -o value or --option value - Using an equals and no space such as -o=value or --option=value - Use a short and no space such as -ovalue",
"default": false,
"type": "boolean"
},
"multiple": {
"description": "Specifies that the argument may have an unknown number of multiple values. Without any other settings, this argument may appear only once.\n\nFor example, --opt val1 val2 is allowed, but --opt val1 val2 --opt val3 is not.\n\nNOTE: Setting this requires `takes_value` to be set to true.",
"default": false,
"type": "boolean"
},
"multipleOccurrences": {
"description": "Specifies that the argument may appear more than once. For flags, this results in the number of occurrences of the flag being recorded. For example -ddd or -d -d -d would count as three occurrences. For options or arguments that take a value, this does not affect how many values they can accept. (i.e. only one at a time is allowed)\n\nFor example, --opt val1 --opt val2 is allowed, but --opt val1 val2 is not.",
"default": false,
"type": "boolean"
},
"numberOfValues": {
"description": "Specifies how many values are required to satisfy this argument. For example, if you had a `-f <file>` argument where you wanted exactly 3 'files' you would set `number_of_values = 3`, and this argument wouldn't be satisfied unless the user provided 3 and only 3 values.\n\n**NOTE:** Does *not* require `multiple_occurrences = true` to be set. Setting `multiple_occurrences = true` would allow `-f <file> <file> <file> -f <file> <file> <file>` where as *not* setting it would only allow one occurrence of this argument.\n\n**NOTE:** implicitly sets `takes_value = true` and `multiple_values = true`.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0.0
},
"possibleValues": {
"description": "Specifies a list of possible values for this argument. At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"minValues": {
"description": "Specifies the minimum number of values for this argument. For example, if you had a -f `<file>` argument where you wanted at least 2 'files', you would set `minValues: 2`, and this argument would be satisfied if the user provided, 2 or more values.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0.0
},
"maxValues": {
"description": "Specifies the maximum number of values are for this argument. For example, if you had a -f `<file>` argument where you wanted up to 3 'files', you would set .max_values(3), and this argument would be satisfied if the user provided, 1, 2, or 3 values.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0.0
},
"required": {
"description": "Sets whether or not the argument is required by default.\n\n- Required by default means it is required, when no other conflicting rules have been evaluated - Conflicting rules take precedence over being required.",
"default": false,
"type": "boolean"
},
"requiredUnlessPresent": {
"description": "Sets an arg that override this arg's required setting i.e. this arg will be required unless this other argument is present.",
"type": [
"string",
"null"
]
},
"requiredUnlessPresentAll": {
"description": "Sets args that override this arg's required setting i.e. this arg will be required unless all these other arguments are present.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"requiredUnlessPresentAny": {
"description": "Sets args that override this arg's required setting i.e. this arg will be required unless at least one of these other arguments are present.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"conflictsWith": {
"description": "Sets a conflicting argument by name i.e. when using this argument, the following argument can't be present and vice versa.",
"type": [
"string",
"null"
]
},
"conflictsWithAll": {
"description": "The same as conflictsWith but allows specifying multiple two-way conflicts per argument.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"requires": {
"description": "Tets an argument by name that is required when this one is present i.e. when using this argument, the following argument must be present.",
"type": [
"string",
"null"
]
},
"requiresAll": {
"description": "Sts multiple arguments by names that are required when this one is present i.e. when using this argument, the following arguments must be present.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"requiresIf": {
"description": "Allows a conditional requirement with the signature [arg, value] the requirement will only become valid if `arg`'s value equals `${value}`.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"requiredIfEq": {
"description": "Allows specifying that an argument is required conditionally with the signature [arg, value] the requirement will only become valid if the `arg`'s value equals `${value}`.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"requireEquals": {
"description": "Requires that options use the --option=val syntax i.e. an equals between the option and associated value.",
"type": [
"boolean",
"null"
]
},
"index": {
"description": "The positional argument index, starting at 1.\n\nThe index refers to position according to other positional argument. It does not define position in the argument list as a whole. When utilized with multiple=true, only the last positional argument may be defined as multiple (i.e. the one with the highest index).",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 1.0
}
},
"additionalProperties": false
},
"BundleConfig": {
"description": "Configuration for tauri-bundler.\n\nSee more: https://tauri.app/v1/api/config#bundleconfig",
"type": "object",
Expand Down
Loading

0 comments on commit 09376af

Please sign in to comment.