File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,10 @@ pub enum SelfCommand {
427
427
pub struct SelfUpdateArgs {
428
428
/// Update to the specified version. If not provided, uv will update to the latest version.
429
429
pub target_version : Option < String > ,
430
+
431
+ /// Specify a github token for authentication during the update process.
432
+ #[ arg( long, env = "UV_GITHUB_TOKEN" ) ]
433
+ pub token : Option < String > ,
430
434
}
431
435
432
436
#[ derive( Args ) ]
Original file line number Diff line number Diff line change @@ -11,10 +11,14 @@ use crate::commands::ExitStatus;
11
11
use crate :: printer:: Printer ;
12
12
13
13
/// Attempt to update the uv binary.
14
- pub ( crate ) async fn self_update ( version : Option < String > , printer : Printer ) -> Result < ExitStatus > {
14
+ pub ( crate ) async fn self_update ( version : Option < String > , token : Option < String > , printer : Printer ) -> Result < ExitStatus > {
15
15
let mut updater = AxoUpdater :: new_for ( "uv" ) ;
16
16
updater. disable_installer_output ( ) ;
17
17
18
+ if let Some ( token) = token {
19
+ updater. set_github_token ( & token) ;
20
+ }
21
+
18
22
// Load the "install receipt" for the current binary. If the receipt is not found, then
19
23
// uv was likely installed via a package manager.
20
24
let Ok ( updater) = updater. load_receipt ( ) else {
Original file line number Diff line number Diff line change @@ -766,8 +766,8 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
766
766
}
767
767
#[ cfg( feature = "self-update" ) ]
768
768
Commands :: Self_ ( SelfNamespace {
769
- command : SelfCommand :: Update ( SelfUpdateArgs { target_version } ) ,
770
- } ) => commands:: self_update ( target_version, printer) . await ,
769
+ command : SelfCommand :: Update ( SelfUpdateArgs { target_version, token } ) ,
770
+ } ) => commands:: self_update ( target_version, token , printer) . await ,
771
771
Commands :: Version { output_format } => {
772
772
commands:: version ( output_format, & mut stdout ( ) ) ?;
773
773
Ok ( ExitStatus :: Success )
You can’t perform that action at this time.
0 commit comments