complete documentation
This commit is contained in:
		| @@ -11,10 +11,20 @@ import { OptionSource } from './OptionSource'; | ||||
|  | ||||
| export class EnvSource extends OptionSource { | ||||
|   public async parse (opt: Option, val:OptionValue): Promise<void> { | ||||
|     if ( | ||||
|       typeof opt.env !== 'undefined' | ||||
|         && typeof process.env[opt.env] !== 'undefined' | ||||
|     ) | ||||
|       await this.assign_arg (opt, val, process.env[opt.env]); | ||||
|     if (typeof opt.env === 'undefined') | ||||
|       return; | ||||
|  | ||||
|     if (typeof process.env[opt.env] === 'undefined') { | ||||
|       if (typeof this.error_callback !== 'undefined') { | ||||
|         this.error_callback ( | ||||
|           opt.name, | ||||
|           null, | ||||
|           new Error ('environment variable does not exist') | ||||
|         ); | ||||
|       } | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|     await this.assign_arg (opt, val, process.env[opt.env]); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user