| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | import * as plugins from './mod.plugins'; | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | let npmciCflare = new plugins.cflare.CflareAccount(); | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * handle cli input | 
					
						
							|  |  |  |  * @param argvArg | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | export let handleCli = async argvArg => { | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  |   if (argvArg._.length >= 2) { | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |     let action: string = argvArg._[1]; | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  |     switch (action) { | 
					
						
							|  |  |  |       default: | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |         plugins.beautylog.error(`>>npmci cloudflare ...<< action >>${action}<< not supported`); | 
					
						
							|  |  |  |         process.exit(1); | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |     plugins.beautylog.log( | 
					
						
							|  |  |  |       `>>npmci cloudflare ...<< cli arguments invalid... Please read the documentation.` | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |     process.exit(1); | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | export let purge = async argvArg => { | 
					
						
							| 
									
										
										
										
											2017-08-27 15:24:17 +02:00
										 |  |  |   npmciCflare.auth({ | 
					
						
							|  |  |  |     email: '', | 
					
						
							|  |  |  |     key: '' | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |   }); | 
					
						
							|  |  |  |   npmciCflare.purgeZone(argvArg._[1]); | 
					
						
							|  |  |  | }; |