()
| 106 | } |
| 107 | |
| 108 | function contractFromArgs() { |
| 109 | const template = arg('--template'); |
| 110 | const options = {}; |
| 111 | const set = (key, value) => { |
| 112 | if (value !== null && value !== undefined && value !== '') options[key] = value; |
| 113 | }; |
| 114 | |
| 115 | set('id', arg('--id')); |
| 116 | set('type', arg('--type', template ? null : 'loop')); |
| 117 | set('title', arg('--title') || arg('--goal') || arg('--command')); |
| 118 | set('goal', arg('--goal') || arg('--title') || arg('--command')); |
| 119 | set('command', arg('--command')); |
| 120 | set('verifierCommand', arg('--verify')); |
| 121 | set('cadence', arg('--cadence')); |
| 122 | set('triggerKind', arg('--trigger', arg('--cadence') ? 'scheduled' : 'manual')); |
| 123 | set('scope', arg('--scope')); |
| 124 | set('reviewArtifact', arg('--artifact')); |
| 125 | const maxAttempts = arg('--max-attempts'); |
| 126 | if (maxAttempts !== null) options.maxAttempts = Number(maxAttempts); |
| 127 | |
| 128 | if (template) return instantiateLoopTemplate(template, options); |
| 129 | return createLoopContract(options); |
| 130 | } |
| 131 | |
| 132 | function main() { |
| 133 | const mode = process.argv[2] || 'list'; |
no test coverage detected