pub struct BergConfig {
pub base_url: String,
pub protocol: String,
pub fancy_tables: bool,
pub no_color: bool,
pub editor: String,
pub max_width: i32,
}Expand description
Parsed configuration of the berg client
Fields§
§base_url: Stringbase url for the forgejo instance that were going to talk to
protocol: Stringprotocol used, typically only a choice between http/https
fancy_tables: boolthe output of some actions is displayed in a table format. This can optionally be disabled to make the output more machine readable
no_color: boolthe output of some actions is displayed with extra colors in the terminal. This can optionally be disabled in case of e.g. color blindness
WIP this does nothing yet since we don’t have colors anyways yet
editor: StringThe editor to be used when doing operations such as writing a comment
max_width: i32Maximum with of the stdout output,
- negative numbers indicate using ‘infinite’ width per line
- zero indicates using the terminals width
- positive numbers are interpreted as max width. You may specify widths that can lead to weird linebreaks. This is a feature for tools which process stdout output line by line. You may also just negative widths in this case.
Falls back to max_width value in config or defaults to 80 otherwise.
Implementations§
Source§impl BergConfig
impl BergConfig
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
tries to read berg config from a known set of locations:
The following list is ordered with descending priority
- environment variables of the form “BERG_CONFIG_FIELD_NAME”
- current directory + “berg.toml”
- data dir + “.berg-cli/berg.toml”“
Note that config options are overridden with these priorities. This implies that if both global and local configs exist, all existing options from the local config override the global configs options. On the other hand, if some options are not overridden, then the global ones are used in this scenario.
pub fn raw() -> Result<Config>
Source§impl BergConfig
impl BergConfig
pub fn url(&self) -> Result<Url>
pub fn make_table(&self) -> TableWrapper
Trait Implementations§
Source§impl Clone for BergConfig
impl Clone for BergConfig
Source§fn clone(&self) -> BergConfig
fn clone(&self) -> BergConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BergConfig
impl Debug for BergConfig
Source§impl Default for BergConfig
impl Default for BergConfig
Source§impl<'de> Deserialize<'de> for BergConfig
impl<'de> Deserialize<'de> for BergConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for BergConfig
impl RefUnwindSafe for BergConfig
impl Send for BergConfig
impl Sync for BergConfig
impl Unpin for BergConfig
impl UnwindSafe for BergConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more