Skip to main content

GlobalArgs

Struct GlobalArgs 

Source
pub struct GlobalArgs {
Show 20 fields pub cwd: PathBuf, pub manifest_path: String, pub api_url: String, pub api_token: Option<String>, pub org: Option<String>, pub proxy_url: String, pub ecosystems: Option<Vec<String>>, pub download_mode: String, pub offline: bool, pub global: bool, pub global_prefix: Option<PathBuf>, pub json: bool, pub verbose: bool, pub silent: bool, pub dry_run: bool, pub yes: bool, pub lock_timeout: Option<u64>, pub break_lock: bool, pub debug: bool, pub no_telemetry: bool,
}
Expand description

Arguments inherited by every subcommand via #[command(flatten)].

Every global flag is parseable on every subcommand. Commands that don’t use a given flag ignore it silently — e.g. list --global parses fine and the global field is unused at runtime.

Fields§

§cwd: PathBuf

Working directory.

§manifest_path: String

Path to patch manifest file (resolved relative to –cwd).

§api_url: String

Socket API URL (authenticated endpoint).

§api_token: Option<String>

Socket API token. Absence selects the public patch proxy.

§org: Option<String>

Organization slug. Auto-resolved when omitted and a token is set.

§proxy_url: String

Public proxy URL used when no API token is set.

§ecosystems: Option<Vec<String>>

Restrict to these ecosystems (comma-separated).

§download_mode: String

Which kind of patch artifact to download when local files are missing. diff (default) fetches the smallest delta archive; package fetches a full per-package tarball; file falls back to legacy per-file blobs.

§offline: bool

Strict airgap: never contact the network. Operations that need remote data fail loudly when this is set.

§global: bool

Operate on globally-installed packages.

§global_prefix: Option<PathBuf>

Override the path used to discover globally-installed packages.

§json: bool

Emit machine-readable JSON output.

§verbose: bool

Show extra detail in human-readable output.

§silent: bool

Suppress non-error output.

§dry_run: bool

Preview the operation without making any mutations.

§yes: bool

Skip interactive prompts.

§lock_timeout: Option<u64>

Seconds to wait for <.socket>/apply.lock before giving up. Default (None) and 0 both mean a single non-blocking try — failing immediately if another process holds the lock. A positive value retries with a 100 ms backoff until the lock frees or the budget elapses. Only meaningful for the mutating subcommands (apply, rollback, repair, remove); other commands accept it silently.

§break_lock: bool

Force-remove <.socket>/apply.lock before attempting acquisition. Use when you are certain no other socket-patch process is running (e.g. a previous run crashed in a way that stripped the OS lock but left the file). Emits a lock_broken warning event in the JSON envelope so the action is auditable. Only meaningful for mutating subcommands; other commands accept it silently.

§debug: bool

Emit verbose debug logs to stderr.

§no_telemetry: bool

Disable anonymous usage telemetry.

Implementations§

Source§

impl GlobalArgs

Source

pub fn resolved_manifest_path(&self) -> PathBuf

Resolve manifest_path against cwd. See socket_patch_core::manifest::operations::resolve_manifest_path.

Source

pub fn api_client_overrides(&self) -> ApiClientEnvOverrides

Build ApiClientEnvOverrides from the CLI flags.

api_token and org are forwarded as Some(_) only when set. api_url and proxy_url are forwarded only when non-empty; GlobalArgs::default() leaves both empty so integration tests that mutate env vars after constructing args still get env-var resolution from get_api_client_with_overrides. In production clap always populates them with either the CLI value, the env value, or the clap-declared default — all non-empty — so the resolved value still flows through.

Trait Implementations§

Source§

impl Args for GlobalArgs

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for GlobalArgs

Source§

fn clone(&self) -> GlobalArgs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GlobalArgs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GlobalArgs

Source§

fn default() -> Self

Defaults intended for test struct literals (e.g. ..GlobalArgs::default()).

In production every field is populated by clap (with the default_value = ".." attribute providing the documented defaults when neither CLI flag nor env var is set), so this Default is only reached from tests building GlobalArgs directly.

api_url and proxy_url are intentionally empty here (not the production default URLs). That lets tests set SOCKET_API_URL / SOCKET_PROXY_URL via std::env::set_var after constructing the args struct and have those env vars flow through to the API client — api_client_overrides skips empty values so the underlying get_api_client_with_overrides falls back to env-var resolution.

Source§

impl FromArgMatches for GlobalArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more