mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 15:56:28 +00:00
feat(go): check for go.work file to show Go module in prompt (#3968)
* check for go.work file to display go version * add test to check for go.work file * update docs to include go.work file * chore(dprint): fmt & upgrade plugins (#3969) Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
parent
a43628d06c
commit
9ebfce1e36
2
.github/config-schema.json
vendored
2
.github/config-schema.json
vendored
@ -556,6 +556,7 @@
|
|||||||
"detect_files": [
|
"detect_files": [
|
||||||
"go.mod",
|
"go.mod",
|
||||||
"go.sum",
|
"go.sum",
|
||||||
|
"go.work",
|
||||||
"glide.yaml",
|
"glide.yaml",
|
||||||
"Gopkg.yml",
|
"Gopkg.yml",
|
||||||
"Gopkg.lock",
|
"Gopkg.lock",
|
||||||
@ -2797,6 +2798,7 @@
|
|||||||
"default": [
|
"default": [
|
||||||
"go.mod",
|
"go.mod",
|
||||||
"go.sum",
|
"go.sum",
|
||||||
|
"go.work",
|
||||||
"glide.yaml",
|
"glide.yaml",
|
||||||
"Gopkg.yml",
|
"Gopkg.yml",
|
||||||
"Gopkg.lock",
|
"Gopkg.lock",
|
||||||
|
@ -1687,6 +1687,7 @@ By default the module will be shown if any of the following conditions are met:
|
|||||||
|
|
||||||
- The current directory contains a `go.mod` file
|
- The current directory contains a `go.mod` file
|
||||||
- The current directory contains a `go.sum` file
|
- The current directory contains a `go.sum` file
|
||||||
|
- The current directory contains a `go.work` file
|
||||||
- The current directory contains a `glide.yaml` file
|
- The current directory contains a `glide.yaml` file
|
||||||
- The current directory contains a `Gopkg.yml` file
|
- The current directory contains a `Gopkg.yml` file
|
||||||
- The current directory contains a `Gopkg.lock` file
|
- The current directory contains a `Gopkg.lock` file
|
||||||
@ -1697,12 +1698,12 @@ By default the module will be shown if any of the following conditions are met:
|
|||||||
### Options
|
### Options
|
||||||
|
|
||||||
| Option | Default | Description |
|
| Option | Default | Description |
|
||||||
| ------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
|
| ------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
||||||
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
|
| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
|
||||||
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
||||||
| `symbol` | `"🐹 "` | A format string representing the symbol of Go. |
|
| `symbol` | `"🐹 "` | A format string representing the symbol of Go. |
|
||||||
| `detect_extensions` | `["go"]` | Which extensions should trigger this module. |
|
| `detect_extensions` | `["go"]` | Which extensions should trigger this module. |
|
||||||
| `detect_files` | `["go.mod", "go.sum", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. |
|
| `detect_files` | `["go.mod", "go.sum", "go.work", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. |
|
||||||
| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. |
|
| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. |
|
||||||
| `style` | `"bold cyan"` | The style for the module. |
|
| `style` | `"bold cyan"` | The style for the module. |
|
||||||
| `disabled` | `false` | Disables the `golang` module. |
|
| `disabled` | `false` | Disables the `golang` module. |
|
||||||
|
@ -26,6 +26,7 @@ impl<'a> Default for GoConfig<'a> {
|
|||||||
detect_files: vec![
|
detect_files: vec![
|
||||||
"go.mod",
|
"go.mod",
|
||||||
"go.sum",
|
"go.sum",
|
||||||
|
"go.work",
|
||||||
"glide.yaml",
|
"glide.yaml",
|
||||||
"Gopkg.yml",
|
"Gopkg.yml",
|
||||||
"Gopkg.lock",
|
"Gopkg.lock",
|
||||||
|
@ -129,6 +129,18 @@ mod tests {
|
|||||||
dir.close()
|
dir.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn folder_with_go_work() -> io::Result<()> {
|
||||||
|
let dir = tempfile::tempdir()?;
|
||||||
|
File::create(dir.path().join("go.work"))?.sync_all()?;
|
||||||
|
|
||||||
|
let actual = ModuleRenderer::new("golang").path(dir.path()).collect();
|
||||||
|
|
||||||
|
let expected = Some(format!("via {}", Color::Cyan.bold().paint("🐹 v1.12.1 ")));
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn folder_with_godeps() -> io::Result<()> {
|
fn folder_with_godeps() -> io::Result<()> {
|
||||||
let dir = tempfile::tempdir()?;
|
let dir = tempfile::tempdir()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user