@@ -10,8 +10,8 @@ import { Url } from "~/app/Url";
1010import { cli } from "~/core/cli" ;
1111import { colors } from "~/core/colors" ;
1212import { is_command_available } from "~/core/is_command_available" ;
13- import { match_group } from "~/core/match_group" ;
1413import { semver_compare } from "~/core/semver_compare" ;
14+ import * as gh from "~/github/gh" ;
1515
1616type Props = {
1717 children : React . ReactNode ;
@@ -112,22 +112,23 @@ export function DependencyCheck(props: Props) {
112112 </ Ink . Text >
113113 }
114114 function = { async ( ) => {
115- const auth_status = await cli ( `gh auth status` , {
116- ignoreExitCode : true ,
117- } ) ;
115+ const options = { ignoreExitCode : true } ;
116+ const auth_status = await cli ( `gh auth status` , options ) ;
118117
119118 if ( auth_status . code === 0 ) {
120- const username = match_group (
121- auth_status . stdout ,
122- RE . auth_username ,
123- "username"
124- ) ;
119+ const username = gh . auth_status ( auth_status . stdout ) ;
125120
126- actions . set ( ( state ) => {
127- state . username = username ;
128- } ) ;
121+ if ( username ) {
122+ actions . set ( ( state ) => {
123+ state . username = username ;
124+ } ) ;
129125
130- return ;
126+ return ;
127+ }
128+ }
129+
130+ if ( actions . isDebug ( ) ) {
131+ actions . error ( "gh auth status could not find username" ) ;
131132 }
132133
133134 actions . output (
@@ -148,8 +149,3 @@ export function DependencyCheck(props: Props) {
148149 </ Await >
149150 ) ;
150151}
151-
152- const RE = {
153- // Logged in to github.com as magus
154- auth_username : / L o g g e d i n t o g i t h u b .c o m a s (?< username > [ ^ \s ] + ) / ,
155- } ;
0 commit comments