88use Symfony \Component \Console \Input \InputInterface ;
99use Symfony \Component \Console \Output \OutputInterface ;
1010
11- class Onboard_Collaborator extends Command {
12- protected static $ defaultName = 'onboard-collaborator ' ;
11+ class Github_Team_Add_User extends Command {
12+ protected static $ defaultName = 'github-team-add-user ' ;
1313 private $ api_helper ;
1414 private $ output ;
1515
@@ -22,29 +22,19 @@ protected function configure() {
2222 $ this
2323 ->setDescription ( 'Adds collaborator to Github Team and Pressable sites. Collaborator can be either a11n or contractor ' )
2424 ->setHelp ( 'This command allows you to bulk add a collaborator to all Pressable sites and a Github team. ' )
25- ->addOption ( 'email ' , null , InputOption::VALUE_REQUIRED , "Collaborator's email. " )
26- ->addOption ( 'github_username ' , null , InputOption::VALUE_REQUIRED , "Collaborator's Github username. " )
27- ->addOption ( 'github_team ' , null , InputOption::VALUE_REQUIRED , sprintf ('Github team can be: %s, %s, or %s. Following this order, level 1 has less privileges than level 3 ' , self ::ACCESS_1 , self ::ACCESS_2 , self ::ACCESS_3 ) );
25+ ->addOption ( 'username ' , null , InputOption::VALUE_REQUIRED , "Collaborator's Github username. " )
26+ ->addOption ( 'team ' , null , InputOption::VALUE_REQUIRED , sprintf ('Github Team can be: %s, %s, or %s. ' , self ::ACCESS_1 , self ::ACCESS_2 , self ::ACCESS_3 ) );
2827 }
2928
3029 protected function execute ( InputInterface $ input , OutputInterface $ output ) {
3130 $ this ->api_helper = new API_Helper ();
3231 $ this ->output = $ output ;
3332
34- // $email = $input->getOption( 'email' );
35- // if ( empty( $email ) ) {
36- // $email = trim( readline( "Please provide the collaborator's email: " ) );
37- // if ( empty( $email ) ) {
38- // $output->writeln( "<error>Missing collaborator's email (eg: --email=user@domain.com).</error>" );
39- // exit;
40- // }
41- // }
42-
4333 $ github_user = $ input ->getOption ( 'github_username ' );
4434 if ( empty ( $ github_user ) ) {
45- $ github_user = trim ( readline ( "Please provide the collaborator's Github username : " ) );
35+ $ github_user = trim ( readline ( "Please provide the collaborator's Github username: " ) );
4636 if ( empty ( $ github_user ) ) {
47- $ github_user ->writeln ( "<error>Missing collaborator's Github username (eg: --github =their_username).</error> " );
37+ $ github_user ->writeln ( "<error>Missing collaborator's Github username (eg: --username =their_username).</error> " );
4838 exit ;
4939 }
5040 }
@@ -53,17 +43,14 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
5343 if ( empty ( $ github_team ) || ! in_array ($ github_team , [self ::ACCESS_1 , self ::ACCESS_2 , self ::ACCESS_3 ]) ) {
5444 $ github_team = trim ( readline ( sprintf ("Please provide the collaborator's Github team. Values can be: %s, %s, or %s: " , self ::ACCESS_1 , self ::ACCESS_2 , self ::ACCESS_3 ) ) );
5545 if ( empty ( $ github_team ) || ! in_array ($ github_team , [self ::ACCESS_1 , self ::ACCESS_2 , self ::ACCESS_3 ]) ) {
56- $ output ->writeln ( '<error>Missing collaborator github_team (eg: --github_team = ' .self ::ACCESS_1 .').</error> ' );
46+ $ output ->writeln ( '<error>Missing collaborator github_team (eg: --team = ' .self ::ACCESS_1 .').</error> ' );
5747 exit ;
5848 }
5949 }
6050
6151 // Start process
6252 $ this ->onboard_github ( $ github_user , $ github_team );
6353
64- // TODO: onboard_pressable()
65-
66-
6754 $ output ->writeln ( '<info>All done!<info> ' );
6855 }
6956
0 commit comments