mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
feat: allow printing config file schema (#3737)
This commit is contained in:
parent
418bac9190
commit
18ad26f98d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
|||||||
/src/init/* text eol=lf
|
/src/init/* text eol=lf
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
|
/.github/config-schema.json text eol=lf
|
4711
.github/config-schema.json
vendored
Normal file
4711
.github/config-schema.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
25
.github/workflows/workflow.yml
vendored
25
.github/workflows/workflow.yml
vendored
@ -129,6 +129,31 @@ jobs:
|
|||||||
- name: Build | Check
|
- name: Build | Check
|
||||||
run: cargo check --workspace --locked --all-features
|
run: cargo check --workspace --locked --all-features
|
||||||
|
|
||||||
|
# Check if config schema needs to be updated to reflect updated configuration options
|
||||||
|
check_if_config_schema_up_to_date:
|
||||||
|
name: Check if config schema is up to date
|
||||||
|
needs: cargo_check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup | Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup | Cache
|
||||||
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
|
- name: Setup | Rust
|
||||||
|
uses: actions-rs/toolchain@v1.0.7
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Run | Generate Schema
|
||||||
|
run: cargo run --locked --features config-schema -- config-schema > .github/config-schema.json
|
||||||
|
|
||||||
|
- name: Check | Detect Changes
|
||||||
|
run: git diff --exit-code .github/config-schema.json
|
||||||
|
|
||||||
# Run tests on Linux, macOS, and Windows
|
# Run tests on Linux, macOS, and Windows
|
||||||
# On both Rust stable and Rust nightly
|
# On both Rust stable and Rust nightly
|
||||||
test:
|
test:
|
||||||
|
@ -154,6 +154,8 @@ dprint fmt
|
|||||||
|
|
||||||
Editor plugins/functionality may help you run these automatically so that you don't accidentally create a PR that fails.
|
Editor plugins/functionality may help you run these automatically so that you don't accidentally create a PR that fails.
|
||||||
|
|
||||||
|
If your changes cause changes to the configuration, you will need to update the configuration schema in `.github/config-schema.json` with `cargo run --features config-schema -- config-schema > .github/config-schema.json`.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Testing is critical to making sure starship works as intended on systems big and small. Starship interfaces with many applications and system APIs when generating the prompt, so there's a lot of room for bugs to slip in.
|
Testing is critical to making sure starship works as intended on systems big and small. Starship interfaces with many applications and system APIs when generating the prompt, so there's a lot of room for bugs to slip in.
|
||||||
@ -291,6 +293,7 @@ everyone remember what they are. Don't worry: most of them are quite simple!
|
|||||||
- [ ] Add the variable to the appropriate location in the "Default Prompt
|
- [ ] Add the variable to the appropriate location in the "Default Prompt
|
||||||
Format" section of the documentation
|
Format" section of the documentation
|
||||||
- [ ] Add an appropriate choice of options to each preset in `docs/presets/README.md`
|
- [ ] Add an appropriate choice of options to each preset in `docs/presets/README.md`
|
||||||
|
- [ ] Update the config file schema by running `cargo run --features config-schema -- config-schema > .github/config-schema.json`
|
||||||
- [ ] Create configs structs/traits in `src/configs/<module>.rs` and add the
|
- [ ] Create configs structs/traits in `src/configs/<module>.rs` and add the
|
||||||
following:
|
following:
|
||||||
- [ ] An entry in `PROMPT_ORDER` (`src/configs/starship_root.rs`)
|
- [ ] An entry in `PROMPT_ORDER` (`src/configs/starship_root.rs`)
|
||||||
|
43
Cargo.lock
generated
43
Cargo.lock
generated
@ -476,6 +476,12 @@ version = "1.0.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541"
|
checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dyn-clone"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "easy-parallel"
|
name = "easy-parallel"
|
||||||
version = "3.2.0"
|
version = "3.2.0"
|
||||||
@ -1410,6 +1416,31 @@ version = "1.0.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schemars"
|
||||||
|
version = "0.8.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c6b5a3c80cea1ab61f4260238409510e814e38b4b563c06044edf91e7dc070e3"
|
||||||
|
dependencies = [
|
||||||
|
"dyn-clone",
|
||||||
|
"indexmap",
|
||||||
|
"schemars_derive",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schemars_derive"
|
||||||
|
version = "0.8.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41ae4dce13e8614c46ac3c38ef1c0d668b101df6ac39817aebdaa26642ddae9b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"serde_derive_internals",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -1442,6 +1473,17 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive_internals"
|
||||||
|
version = "0.25.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.79"
|
version = "1.0.79"
|
||||||
@ -1567,6 +1609,7 @@ dependencies = [
|
|||||||
"rayon",
|
"rayon",
|
||||||
"regex",
|
"regex",
|
||||||
"rust-ini",
|
"rust-ini",
|
||||||
|
"schemars",
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -16,6 +16,7 @@ include = [
|
|||||||
"LICENSE",
|
"LICENSE",
|
||||||
"/README.md",
|
"/README.md",
|
||||||
"docs/.vuepress/public/presets/toml/",
|
"docs/.vuepress/public/presets/toml/",
|
||||||
|
".github/config-schema.json",
|
||||||
]
|
]
|
||||||
keywords = ["prompt", "shell", "bash", "fish", "zsh"]
|
keywords = ["prompt", "shell", "bash", "fish", "zsh"]
|
||||||
license = "ISC"
|
license = "ISC"
|
||||||
@ -31,6 +32,7 @@ The minimal, blazing-fast, and infinitely customizable prompt for any shell! ☄
|
|||||||
[features]
|
[features]
|
||||||
default = ["battery"]
|
default = ["battery"]
|
||||||
battery = ["starship-battery"]
|
battery = ["starship-battery"]
|
||||||
|
config-schema = ["schemars"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ansi_term = "0.12.1"
|
ansi_term = "0.12.1"
|
||||||
@ -81,6 +83,11 @@ process_control = { version = "3.3.0", features = ["crossbeam-channel"] }
|
|||||||
|
|
||||||
shell-words = "1.1.0"
|
shell-words = "1.1.0"
|
||||||
|
|
||||||
|
[dependencies.schemars]
|
||||||
|
version = "0.8.8"
|
||||||
|
optional = true
|
||||||
|
features = ["preserve_order", "indexmap"]
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = { version = "0.3.9", features = ["winuser", "securitybaseapi", "processthreadsapi", "handleapi", "impl-default"] }
|
winapi = { version = "0.3.9", features = ["winuser", "securitybaseapi", "processthreadsapi", "handleapi", "impl-default"] }
|
||||||
|
|
||||||
|
1
docs/.vuepress/public/config-schema.json
Symbolic link
1
docs/.vuepress/public/config-schema.json
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../.github/config-schema.json
|
@ -9,6 +9,9 @@ mkdir -p ~/.config && touch ~/.config/starship.toml
|
|||||||
All configuration for starship is done in this [TOML](https://github.com/toml-lang/toml) file:
|
All configuration for starship is done in this [TOML](https://github.com/toml-lang/toml) file:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
|
# Get editor completions based on the config schema
|
||||||
|
"$schema" = 'https://starship.rs/config-schema.json'
|
||||||
|
|
||||||
# Inserts a blank line between shell prompts
|
# Inserts a blank line between shell prompts
|
||||||
add_newline = true
|
add_newline = true
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ impl<'a, T: Deserialize<'a> + Default> ModuleConfig<'a, ValueError> for T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Either<A, B> {
|
pub enum Either<A, B> {
|
||||||
First(A),
|
First(A),
|
||||||
@ -77,6 +78,24 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "config-schema")]
|
||||||
|
impl<T> schemars::JsonSchema for VecOr<T>
|
||||||
|
where
|
||||||
|
T: schemars::JsonSchema + Sized,
|
||||||
|
{
|
||||||
|
fn schema_name() -> String {
|
||||||
|
Either::<T, Vec<T>>::schema_name()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
|
||||||
|
Either::<T, Vec<T>>::json_schema(gen)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_referenceable() -> bool {
|
||||||
|
Either::<T, Vec<T>>::is_referenceable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Root config of starship.
|
/// Root config of starship.
|
||||||
pub struct StarshipConfig {
|
pub struct StarshipConfig {
|
||||||
pub config: Option<Value>,
|
pub config: Option<Value>,
|
||||||
|
@ -2,15 +2,48 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
/// ## AWS
|
||||||
|
///
|
||||||
|
/// The `aws` module shows the current AWS region and profile when
|
||||||
|
/// credentials or a `credential_process` have been setup. This is based on
|
||||||
|
/// `AWS_REGION`, `AWS_DEFAULT_REGION`, and `AWS_PROFILE` env var with
|
||||||
|
/// `~/.aws/config` file. This module also shows an expiration timer when using temporary
|
||||||
|
/// credentials.
|
||||||
|
///
|
||||||
|
/// The module will display a profile only if its credentials are present in
|
||||||
|
/// `~/.aws/credentials` or a `credential_process` is defined in
|
||||||
|
/// `~/.aws/config`. Alternatively, having any of the `AWS_ACCESS_KEY_ID`,
|
||||||
|
/// `AWS_SECRET_ACCESS_KEY`, or `AWS_SESSION_TOKEN` env vars defined will
|
||||||
|
/// also suffice.
|
||||||
|
///
|
||||||
|
/// When using [aws-vault](https://github.com/99designs/aws-vault) the profile
|
||||||
|
/// is read from the `AWS_VAULT` env var and the credentials expiration date
|
||||||
|
/// is read from the `AWS_SESSION_EXPIRATION` env var.
|
||||||
|
///
|
||||||
|
/// When using [awsu](https://github.com/kreuzwerker/awsu) the profile
|
||||||
|
/// is read from the `AWSU_PROFILE` env var.
|
||||||
|
///
|
||||||
|
/// When using [AWSume](https://awsu.me) the profile
|
||||||
|
/// is read from the `AWSUME_PROFILE` env var and the credentials expiration
|
||||||
|
/// date is read from the `AWSUME_EXPIRATION` env var.
|
||||||
pub struct AwsConfig<'a> {
|
pub struct AwsConfig<'a> {
|
||||||
|
/// The format for the module.
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
/// The symbol used before displaying the current AWS profile.
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
/// The style for the module.
|
||||||
pub style: &'a str,
|
pub style: &'a str,
|
||||||
|
/// Disables the AWS module.
|
||||||
pub disabled: bool,
|
pub disabled: bool,
|
||||||
|
/// Table of region aliases to display in addition to the AWS name.
|
||||||
pub region_aliases: HashMap<String, &'a str>,
|
pub region_aliases: HashMap<String, &'a str>,
|
||||||
|
/// Table of profile aliases to display in addition to the AWS name.
|
||||||
pub profile_aliases: HashMap<String, &'a str>,
|
pub profile_aliases: HashMap<String, &'a str>,
|
||||||
|
/// The symbol displayed when the temporary credentials have expired.
|
||||||
pub expiration_symbol: &'a str,
|
pub expiration_symbol: &'a str,
|
||||||
|
/// If true displays info even if `credentials`, `credential_process` or `sso_start_url` have not been setup.
|
||||||
pub force_display: bool,
|
pub force_display: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct AzureConfig<'a> {
|
pub struct AzureConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct BatteryConfig<'a> {
|
pub struct BatteryConfig<'a> {
|
||||||
pub full_symbol: &'a str,
|
pub full_symbol: &'a str,
|
||||||
@ -30,6 +31,7 @@ impl<'a> Default for BatteryConfig<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct BatteryDisplayConfig<'a> {
|
pub struct BatteryDisplayConfig<'a> {
|
||||||
pub threshold: i64,
|
pub threshold: i64,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct BufConfig<'a> {
|
pub struct BufConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CConfig<'a> {
|
pub struct CConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CharacterConfig<'a> {
|
pub struct CharacterConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CMakeConfig<'a> {
|
pub struct CMakeConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CmdDurationConfig<'a> {
|
pub struct CmdDurationConfig<'a> {
|
||||||
pub min_time: i64,
|
pub min_time: i64,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CobolConfig<'a> {
|
pub struct CobolConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CondaConfig<'a> {
|
pub struct CondaConfig<'a> {
|
||||||
pub truncation_length: usize,
|
pub truncation_length: usize,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ContainerConfig<'a> {
|
pub struct ContainerConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CrystalConfig<'a> {
|
pub struct CrystalConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -3,6 +3,7 @@ use crate::config::VecOr;
|
|||||||
use serde::{self, Deserialize, Serialize};
|
use serde::{self, Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CustomConfig<'a> {
|
pub struct CustomConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct DartConfig<'a> {
|
pub struct DartConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct DenoConfig<'a> {
|
pub struct DenoConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -3,6 +3,7 @@ use indexmap::IndexMap;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct DirectoryConfig<'a> {
|
pub struct DirectoryConfig<'a> {
|
||||||
pub truncation_length: i64,
|
pub truncation_length: i64,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct DockerContextConfig<'a> {
|
pub struct DockerContextConfig<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct DotnetConfig<'a> {
|
pub struct DotnetConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ElixirConfig<'a> {
|
pub struct ElixirConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ElmConfig<'a> {
|
pub struct ElmConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct EnvVarConfig<'a> {
|
pub struct EnvVarConfig<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ErlangConfig<'a> {
|
pub struct ErlangConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct FillConfig<'a> {
|
pub struct FillConfig<'a> {
|
||||||
pub style: &'a str,
|
pub style: &'a str,
|
||||||
|
@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GcloudConfig<'a> {
|
pub struct GcloudConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GitBranchConfig<'a> {
|
pub struct GitBranchConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GitCommitConfig<'a> {
|
pub struct GitCommitConfig<'a> {
|
||||||
pub commit_hash_length: usize,
|
pub commit_hash_length: usize,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GitMetricsConfig<'a> {
|
pub struct GitMetricsConfig<'a> {
|
||||||
pub added_style: &'a str,
|
pub added_style: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GitStateConfig<'a> {
|
pub struct GitStateConfig<'a> {
|
||||||
pub rebase: &'a str,
|
pub rebase: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GitStatusConfig<'a> {
|
pub struct GitStatusConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GoConfig<'a> {
|
pub struct GoConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct HaskellConfig<'a> {
|
pub struct HaskellConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct HelmConfig<'a> {
|
pub struct HelmConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct HgBranchConfig<'a> {
|
pub struct HgBranchConfig<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct HostnameConfig<'a> {
|
pub struct HostnameConfig<'a> {
|
||||||
pub ssh_only: bool,
|
pub ssh_only: bool,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct JavaConfig<'a> {
|
pub struct JavaConfig<'a> {
|
||||||
pub disabled: bool,
|
pub disabled: bool,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct JobsConfig<'a> {
|
pub struct JobsConfig<'a> {
|
||||||
pub threshold: i64,
|
pub threshold: i64,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct JuliaConfig<'a> {
|
pub struct JuliaConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct KotlinConfig<'a> {
|
pub struct KotlinConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct KubernetesConfig<'a> {
|
pub struct KubernetesConfig<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize, Default)]
|
#[derive(Clone, Deserialize, Serialize, Default)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
|
#[serde(default)]
|
||||||
pub struct LineBreakConfig {
|
pub struct LineBreakConfig {
|
||||||
pub disabled: bool,
|
pub disabled: bool,
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct LocalipConfig<'a> {
|
pub struct LocalipConfig<'a> {
|
||||||
pub ssh_only: bool,
|
pub ssh_only: bool,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct LuaConfig<'a> {
|
pub struct LuaConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct MemoryConfig<'a> {
|
pub struct MemoryConfig<'a> {
|
||||||
pub threshold: i64,
|
pub threshold: i64,
|
||||||
|
@ -78,8 +78,12 @@ pub mod zig;
|
|||||||
pub use starship_root::*;
|
pub use starship_root::*;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Default)]
|
#[derive(Serialize, Deserialize, Clone, Default)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct FullConfig<'a> {
|
pub struct FullConfig<'a> {
|
||||||
|
// Meta
|
||||||
|
#[serde(rename = "$schema")]
|
||||||
|
schema: String,
|
||||||
// Root config
|
// Root config
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
root: StarshipRootConfig,
|
root: StarshipRootConfig,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct NimConfig<'a> {
|
pub struct NimConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct NixShellConfig<'a> {
|
pub struct NixShellConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct NodejsConfig<'a> {
|
pub struct NodejsConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct OCamlConfig<'a> {
|
pub struct OCamlConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct OspConfig<'a> {
|
pub struct OspConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PackageConfig<'a> {
|
pub struct PackageConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PerlConfig<'a> {
|
pub struct PerlConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PhpConfig<'a> {
|
pub struct PhpConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PulumiConfig<'a> {
|
pub struct PulumiConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PureScriptConfig<'a> {
|
pub struct PureScriptConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -3,6 +3,7 @@ use crate::config::VecOr;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PythonConfig<'a> {
|
pub struct PythonConfig<'a> {
|
||||||
pub pyenv_version_name: bool,
|
pub pyenv_version_name: bool,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct RedConfig<'a> {
|
pub struct RedConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct RLangConfig<'a> {
|
pub struct RLangConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct RubyConfig<'a> {
|
pub struct RubyConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct RustConfig<'a> {
|
pub struct RustConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ScalaConfig<'a> {
|
pub struct ScalaConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ShellConfig<'a> {
|
pub struct ShellConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ShLvlConfig<'a> {
|
pub struct ShLvlConfig<'a> {
|
||||||
pub threshold: i64,
|
pub threshold: i64,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct SingularityConfig<'a> {
|
pub struct SingularityConfig<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize, Debug)]
|
#[derive(Clone, Serialize, Deserialize, Debug)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct StarshipRootConfig {
|
pub struct StarshipRootConfig {
|
||||||
|
#[serde(rename = "$schema")]
|
||||||
|
schema: String,
|
||||||
pub format: String,
|
pub format: String,
|
||||||
pub right_format: String,
|
pub right_format: String,
|
||||||
pub continuation_prompt: String,
|
pub continuation_prompt: String,
|
||||||
@ -96,6 +99,7 @@ pub const PROMPT_ORDER: &[&str] = &[
|
|||||||
impl<'a> Default for StarshipRootConfig {
|
impl<'a> Default for StarshipRootConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
StarshipRootConfig {
|
StarshipRootConfig {
|
||||||
|
schema: "https://starship.rs/config-schema.json".to_string(),
|
||||||
format: "$all".to_string(),
|
format: "$all".to_string(),
|
||||||
right_format: "".to_string(),
|
right_format: "".to_string(),
|
||||||
continuation_prompt: "[∙](bright-black) ".to_string(),
|
continuation_prompt: "[∙](bright-black) ".to_string(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct StatusConfig<'a> {
|
pub struct StatusConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct SudoConfig<'a> {
|
pub struct SudoConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct SwiftConfig<'a> {
|
pub struct SwiftConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct TerraformConfig<'a> {
|
pub struct TerraformConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct TimeConfig<'a> {
|
pub struct TimeConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct UsernameConfig<'a> {
|
pub struct UsernameConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct VConfig<'a> {
|
pub struct VConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct VagrantConfig<'a> {
|
pub struct VagrantConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct VcshConfig<'a> {
|
pub struct VcshConfig<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ZigConfig<'a> {
|
pub struct ZigConfig<'a> {
|
||||||
pub format: &'a str,
|
pub format: &'a str,
|
||||||
|
@ -97,6 +97,9 @@ enum Commands {
|
|||||||
#[clap(default_value = "disabled")]
|
#[clap(default_value = "disabled")]
|
||||||
value: String,
|
value: String,
|
||||||
},
|
},
|
||||||
|
#[cfg(feature = "config-schema")]
|
||||||
|
/// Generate a schema for the starship configuration as JSON-schema
|
||||||
|
ConfigSchema,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -216,6 +219,8 @@ fn main() {
|
|||||||
.map(char::from)
|
.map(char::from)
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
),
|
),
|
||||||
|
#[cfg(feature = "config-schema")]
|
||||||
|
Commands::ConfigSchema => print::print_schema(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/print.rs
12
src/print.rs
@ -444,6 +444,12 @@ fn load_formatter_and_modules<'a>(context: &'a Context) -> (StringFormatter<'a>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "config-schema")]
|
||||||
|
pub fn print_schema() {
|
||||||
|
let schema = schemars::schema_for!(crate::configs::FullConfig);
|
||||||
|
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -483,4 +489,10 @@ mod test {
|
|||||||
let actual = get_prompt(context);
|
let actual = get_prompt(context);
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(feature = "config-schema")]
|
||||||
|
fn print_schema_does_not_panic() {
|
||||||
|
print_schema();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user