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