mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'synis/better-path-autocomplete' into 'master'
path-autocomplete See merge request veloren/veloren!4342
This commit is contained in:
commit
e002ed2a84
@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Added reworked dungeon: Haniwa Catacombs
|
- Added reworked dungeon: Haniwa Catacombs
|
||||||
- Added dungeon: Terracotta Ruins
|
- Added dungeon: Terracotta Ruins
|
||||||
- Sand and crystal cave biome
|
- Sand and crystal cave biome
|
||||||
|
- In commands that reference assets you can now use `#name` and press tab to cycle through assets with that name.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -597,6 +597,13 @@ impl TabComplete for ArgumentSpec {
|
|||||||
.map(|c| c.to_string())
|
.map(|c| c.to_string())
|
||||||
.collect(),
|
.collect(),
|
||||||
ArgumentSpec::AssetPath(_, prefix, paths, _) => {
|
ArgumentSpec::AssetPath(_, prefix, paths, _) => {
|
||||||
|
if let Some(part_stripped) = part.strip_prefix('#') {
|
||||||
|
paths
|
||||||
|
.iter()
|
||||||
|
.filter(|string| string.contains(part_stripped))
|
||||||
|
.filter_map(|c| Some(c.strip_prefix(prefix)?.to_string()))
|
||||||
|
.collect()
|
||||||
|
} else {
|
||||||
let part_with_prefix = prefix.to_string() + part;
|
let part_with_prefix = prefix.to_string() + part;
|
||||||
let depth = part_with_prefix.split('.').count();
|
let depth = part_with_prefix.split('.').count();
|
||||||
paths
|
paths
|
||||||
@ -606,6 +613,7 @@ impl TabComplete for ArgumentSpec {
|
|||||||
.filter(|string| string.starts_with(&part_with_prefix))
|
.filter(|string| string.starts_with(&part_with_prefix))
|
||||||
.filter_map(|c| Some(c.strip_prefix(prefix)?.to_string()))
|
.filter_map(|c| Some(c.strip_prefix(prefix)?.to_string()))
|
||||||
.collect()
|
.collect()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
ArgumentSpec::Boolean(_, part, _) => ["true", "false"]
|
ArgumentSpec::Boolean(_, part, _) => ["true", "false"]
|
||||||
.iter()
|
.iter()
|
||||||
|
Loading…
Reference in New Issue
Block a user