pub struct GitLab<R: ProcessRunner = JobRunner> { /* private fields */ }Expand description
The real GitLab client. Generic over the ProcessRunner so tests can
inject a fake process executor; GitLab::new() uses the real job-backed
runner.
Implementations§
Source§impl<R: ProcessRunner> GitLab<R>
impl<R: ProcessRunner> GitLab<R>
Sourcepub fn with_runner(runner: R) -> Self
pub fn with_runner(runner: R) -> Self
Create a client driving runner — inject a fake in tests.
Sourcepub fn default_timeout(self, timeout: Duration) -> Self
pub fn default_timeout(self, timeout: Duration) -> Self
Apply a default timeout to every command this client builds.
Sourcepub fn default_env(
self,
key: impl AsRef<OsStr>,
value: impl AsRef<OsStr>,
) -> Self
pub fn default_env( self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>, ) -> Self
Set an environment variable on every command this client builds
(e.g. GIT_TERMINAL_PROMPT=0).
Sourcepub fn default_env_remove(self, key: impl AsRef<OsStr>) -> Self
pub fn default_env_remove(self, key: impl AsRef<OsStr>) -> Self
Remove an inherited environment variable on every command this client builds.
Source§impl<R: ProcessRunner> GitLab<R>
impl<R: ProcessRunner> GitLab<R>
Sourcepub fn default_cancel_on(self, token: CancellationToken) -> Self
pub fn default_cancel_on(self, token: CancellationToken) -> Self
Cancel every command this client builds when token fires (a
per-command cancel_on replaces the default — see
CliClient::default_cancel_on).
Source§impl<R: ProcessRunner> GitLab<R>
impl<R: ProcessRunner> GitLab<R>
Sourcepub async fn run_args(&self, args: &[&str]) -> Result<String>
pub async fn run_args(&self, args: &[&str]) -> Result<String>
Run glab <args> over string slices — glab.run_args(&["mr", "list"])
without allocating a Vec<String>. Inherent (not on the object-safe
trait), so it can take &[&str]; forwards to the same path as
GitLabApi::run.
Sourcepub async fn run_raw_args(&self, args: &[&str]) -> Result<ProcessResult<String>>
pub async fn run_raw_args(&self, args: &[&str]) -> Result<ProcessResult<String>>
Like run_args but never errors on a non-zero exit
(mirrors GitLabApi::run_raw).
Trait Implementations§
Source§impl<R: ProcessRunner> GitLabApi for GitLab<R>
impl<R: ProcessRunner> GitLabApi for GitLab<R>
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab <args>, returning trimmed stdout (throws on a non-zero exit).Source§fn run_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
GitLabApi::run but never errors on a non-zero exit — returns the
captured ProcessResult.Source§fn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
glab --version).Source§fn auth_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn auth_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
glab auth status exits zero). Reflects
the exit code as a bool — any non-zero exit reads as false, never an
error; only a spawn failure or timeout errors. Read moreSource§fn repo_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Project>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn repo_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Project>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
dir (glab repo view --output json).Source§fn mr_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<MergeRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<MergeRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
dir
(glab mr list --per-page 100 --output json). Returns up to 100 (100 is
the GitLab API per-page max); use run for more.Source§fn mr_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<MergeRequest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<MergeRequest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab mr view <id> --output json).Source§fn mr_create<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
spec: MrCreate,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_create<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
spec: MrCreate,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab mr create). The MrCreate spec carries the title,
body, and the optional source (None = the current branch) and target
(None = the project default) branches.Source§fn mr_merge<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
strategy: MergeStrategy,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_merge<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
strategy: MergeStrategy,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab mr merge <id> --yes --auto-merge=false [--squash|--rebase]) — --auto-merge=false overrides
glab’s default of enabling merge-when-pipeline-succeeds. See
MergeStrategy.Source§fn mr_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_ready<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab mr update <id> --ready).Source§fn mr_close<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_close<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab mr close <id>).Source§fn mr_checks<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<CiStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mr_checks<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<CiStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
glab mr view <id> --output json,
reading head_pipeline.status). CiStatus::None when no pipeline ran.Source§fn issue_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Issue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn issue_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Issue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
dir
(glab issue list --per-page 100 --output json). Returns up to 100 (100
is the GitLab API per-page max); use run for more.Source§fn issue_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Issue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn issue_view<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Issue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
iid)
(glab issue view <number> --output json).Source§fn issue_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
title: &'life2 str,
body: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn issue_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
title: &'life2 str,
body: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
glab issue create --title <t> --description <d> --yes). --yes skips
glab’s interactive submission prompt — mirrors
mr_create.Source§fn release_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Release>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn release_list<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<Release>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
dir (glab release list --per-page 100 --output json).
Returns up to 100 (100 is the GitLab API per-page max); use
run for more.Source§fn release_view<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
tag: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Release>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn release_view<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
dir: &'life1 Path,
tag: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Release>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
glab release view <tag> --output json).
The tag is a bare positional, so it is guarded with
reject_flag_like (a leading - or empty value is rejected before any
process spawns).