Make --offline a global argument (#3729)

This commit is contained in:
Charlie Marsh 2024-05-21 20:09:05 -04:00 committed by GitHub
parent 285adaed64
commit d33577fc16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 60 additions and 129 deletions

View file

@ -42,6 +42,7 @@ impl Combine for Options {
fn combine(self, other: Options) -> Options {
Options {
native_tls: self.native_tls.combine(other.native_tls),
offline: self.offline.combine(other.offline),
no_cache: self.no_cache.combine(other.no_cache),
preview: self.preview.combine(other.preview),
cache_dir: self.cache_dir.combine(other.cache_dir),
@ -68,7 +69,6 @@ impl Combine for PipOptions {
.break_system_packages
.combine(other.break_system_packages),
target: self.target.combine(other.target),
offline: self.offline.combine(other.offline),
index_url: self.index_url.combine(other.index_url),
extra_index_url: self.extra_index_url.combine(other.extra_index_url),
no_index: self.no_index.combine(other.no_index),

View file

@ -32,6 +32,7 @@ pub(crate) struct Tools {
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct Options {
pub native_tls: Option<bool>,
pub offline: Option<bool>,
pub no_cache: Option<bool>,
pub preview: Option<bool>,
pub cache_dir: Option<PathBuf>,
@ -48,7 +49,6 @@ pub struct PipOptions {
pub system: Option<bool>,
pub break_system_packages: Option<bool>,
pub target: Option<PathBuf>,
pub offline: Option<bool>,
pub index_url: Option<IndexUrl>,
pub extra_index_url: Option<Vec<IndexUrl>>,
pub no_index: Option<bool>,