1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-02 16:40:51 +00:00

chore: fix typos in comments (#4122)

This commit is contained in:
Kian-Meng Ang 2022-06-29 02:19:17 +08:00 committed by GitHub
parent 3538efe727
commit 018b077630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 13 additions and 13 deletions

View File

@ -181,7 +181,7 @@ impl<'a> Context<'a> {
home_dir() home_dir()
} }
// Retrives a environment variable from the os or from a table if in testing mode // Retrieves a environment variable from the os or from a table if in testing mode
#[cfg(test)] #[cfg(test)]
pub fn get_env<K: AsRef<str>>(&self, key: K) -> Option<String> { pub fn get_env<K: AsRef<str>>(&self, key: K) -> Option<String> {
self.env self.env
@ -195,7 +195,7 @@ impl<'a> Context<'a> {
env::var(key.as_ref()).ok() env::var(key.as_ref()).ok()
} }
// Retrives a environment variable from the os or from a table if in testing mode (os version) // Retrieves a environment variable from the os or from a table if in testing mode (os version)
#[cfg(test)] #[cfg(test)]
pub fn get_env_os<K: AsRef<str>>(&self, key: K) -> Option<OsString> { pub fn get_env_os<K: AsRef<str>>(&self, key: K) -> Option<OsString> {
self.env.get(key.as_ref()).map(OsString::from) self.env.get(key.as_ref()).map(OsString::from)

View File

@ -447,7 +447,7 @@ where
{ {
// Handle other interpretable characters // Handle other interpretable characters
match shell { match shell {
// Bash might interepret baskslashes, backticks and $ // Bash might interpret backslashes, backticks and $
// see #658 for more details // see #658 for more details
Shell::Bash => text Shell::Bash => text
.into() .into()

View File

@ -63,7 +63,7 @@ impl StarshipPath {
if e.kind() != io::ErrorKind::NotFound { if e.kind() != io::ErrorKind::NotFound {
log::warn!("Failed to convert \"{}\" to unix path:\n{:?}", str_path, e); log::warn!("Failed to convert \"{}\" to unix path:\n{:?}", str_path, e);
} }
// Failed to execute cygpath.exe means there're not inside cygwin evironment,return directly. // Failed to execute cygpath.exe means there're not inside cygwin environment,return directly.
return self.sprint(); return self.sprint();
} }
}; };

View File

@ -38,7 +38,7 @@ starship_precmd() {
fi fi
local NUM_JOBS=0 local NUM_JOBS=0
# Evaluate the number of jobs before running the preseved prompt command, so that tools # Evaluate the number of jobs before running the preserved prompt command, so that tools
# like z/autojump, which background certain jobs, do not cause spurious background jobs # like z/autojump, which background certain jobs, do not cause spurious background jobs
# to be displayed by starship. Also avoids forking to run `wc`, slightly improving perf. # to be displayed by starship. Also avoids forking to run `wc`, slightly improving perf.
for job in $(jobs -p); do [[ $job ]] && ((NUM_JOBS++)); done for job in $(jobs -p); do [[ $job ]] && ((NUM_JOBS++)); done

View File

@ -87,8 +87,8 @@ fn get_battery_status(context: &Context) -> Option<BatteryStatus> {
/// the merge returns Charging if at least one is charging /// the merge returns Charging if at least one is charging
/// Discharging if at least one is Discharging /// Discharging if at least one is Discharging
/// Full if both are Full or one is Full and the other Unknow /// Full if both are Full or one is Full and the other Unknown
/// Empty if both are Empty or one is Empty and the other Unknow /// Empty if both are Empty or one is Empty and the other Unknown
/// Unknown otherwise /// Unknown otherwise
fn merge_battery_states(state1: battery::State, state2: battery::State) -> battery::State { fn merge_battery_states(state1: battery::State, state2: battery::State) -> battery::State {
use battery::State::{Charging, Discharging, Unknown}; use battery::State::{Charging, Discharging, Unknown};

View File

@ -237,7 +237,7 @@ fn exec_command(cmd: &str, context: &Context, config: &CustomConfig) -> Option<S
/// If the specified shell refers to `PowerShell`, adds the arguments "-Command -" to the /// If the specified shell refers to `PowerShell`, adds the arguments "-Command -" to the
/// given command. /// given command.
/// Retruns `false` if the shell shell expects scripts as arguments, `true` if as `stdin`. /// Returns `false` if the shell shell expects scripts as arguments, `true` if as `stdin`.
fn handle_shell(command: &mut Command, shell: &str, shell_args: &[&str]) -> bool { fn handle_shell(command: &mut Command, shell: &str, shell_args: &[&str]) -> bool {
let shell_exe = Path::new(shell).file_stem(); let shell_exe = Path::new(shell).file_stem();
let no_args = shell_args.is_empty(); let no_args = shell_args.is_empty();

View File

@ -15,7 +15,7 @@ use crate::utils;
/// - Or a file named `$DOCKER_CONFIG/config.json` /// - Or a file named `$DOCKER_CONFIG/config.json`
/// - The file is JSON and contains a field named `currentContext` /// - The file is JSON and contains a field named `currentContext`
/// - The value of `currentContext` is not `default` /// - The value of `currentContext` is not `default`
/// - If multiple criterias are met, we use the following order to define the docker context: /// - If multiple criteria are met, we use the following order to define the docker context:
/// - `DOCKER_HOST`, `DOCKER_CONTEXT`, $HOME/.docker/config.json, $`DOCKER_CONFIG/config.json` /// - `DOCKER_HOST`, `DOCKER_CONTEXT`, $HOME/.docker/config.json, $`DOCKER_CONFIG/config.json`
/// - (This is the same order docker follows, as `DOCKER_HOST` and `DOCKER_CONTEXT` override the /// - (This is the same order docker follows, as `DOCKER_HOST` and `DOCKER_CONTEXT` override the
/// config) /// config)

View File

@ -92,7 +92,7 @@ fn parse_version(version: &str) -> &str {
version version
} }
/// Find a file describing a Pulumi package in the current directory (or any parrent directory). /// Find a file describing a Pulumi package in the current directory (or any parent directory).
fn find_package_file(path: &Path) -> Option<PathBuf> { fn find_package_file(path: &Path) -> Option<PathBuf> {
for path in path.ancestors() { for path in path.ancestors() {
log::trace!("Looking for package file in {:?}", path); log::trace!("Looking for package file in {:?}", path);

View File

@ -100,7 +100,7 @@ pub fn is_write_allowed(folder_path: &Path) -> std::result::Result<bool, String>
GenericAll: FILE_ALL_ACCESS.0, GenericAll: FILE_ALL_ACCESS.0,
}; };
let mut priviledges: PRIVILEGE_SET = PRIVILEGE_SET::default(); let mut privileges: PRIVILEGE_SET = PRIVILEGE_SET::default();
let mut priv_size = mem::size_of::<PRIVILEGE_SET>() as _; let mut priv_size = mem::size_of::<PRIVILEGE_SET>() as _;
let mut granted_access = 0; let mut granted_access = 0;
let mut access_rights = FILE_GENERIC_WRITE; let mut access_rights = FILE_GENERIC_WRITE;
@ -112,7 +112,7 @@ pub fn is_write_allowed(folder_path: &Path) -> std::result::Result<bool, String>
impersonated_token, impersonated_token,
access_rights.0, access_rights.0,
&mapping, &mapping,
&mut priviledges, &mut privileges,
&mut priv_size, &mut priv_size,
&mut granted_access, &mut granted_access,
&mut result, &mut result,

View File

@ -244,7 +244,7 @@ pub fn explain(args: Properties) {
" ".repeat(max_module_width - (info.value_len)) " ".repeat(max_module_width - (info.value_len))
); );
for g in info.desc.graphemes(true) { for g in info.desc.graphemes(true) {
// Handle ANSI escape sequnces // Handle ANSI escape sequences
if g == "\x1B" { if g == "\x1B" {
escaping = true; escaping = true;
} }