Starship: Hostname module doesn't respect prefix/suffix

Created on 14 Apr 2020  路  4Comments  路  Source: starship/starship

Current Behavior

The hostname module doesn't treat the values of hostname.prefix and hostname.suffix in starship.toml as an actual prefix and suffix. Instead, it wraps them into the main hostname value and then forces a prefix of "on " before that value, as below:

module.set_style(config.style);
let hostname_stacked = format!("{}{}{}", config.prefix, host, config.suffix);
module.create_segment("hostname", &SegmentConfig::new(&hostname_stacked));
module.get_prefix().set_value("on ");

Expected Behavior

The values of hostname.prefix and hostname.suffix as set by the user replace the defaults, and appear with the same formatting (i.e. unformatted) as the default "on " prefix. In other words, the following starship.toml...

[hostname]
prefix = "@ "

...and the hostname Foo would result in the hostname module printing...

@ Foo

...rather than the default:

on Foo

Environment and shell configuration trimmed, as the cause seems to be a directly apparent design choice in the code - I can add them again if needed, though

馃悰 bug

Most helpful comment

This should be fixed by #1071 and the switch to use format strings.

All 4 comments

This should be fixed by #1071 and the switch to use format strings.

Still an issue on the latest starship?

Still an issue on the latest starship?

For now yes but this will be resolved as part of the v0.45.0 release.

Since we are getting close to the v0.45.0 release, I'm going to close this issue so we can see what is actually left to do in the milestone and what still needs a little bit of work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Stupremee picture Stupremee  路  4Comments

tlb42 picture tlb42  路  3Comments

sirMerr picture sirMerr  路  4Comments

matchai picture matchai  路  3Comments

chipbuster picture chipbuster  路  4Comments