-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·43 lines (36 loc) · 1.37 KB
/
index.js
File metadata and controls
executable file
·43 lines (36 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
const { Command } = require('commander');
const {add, addAll} = require("./add");
const {getDefaultConfigPath} = require("./utils");
const program = new Command();
program
.name("flow-contracts")
.description("A CLI to help manage and import Flow contracts")
program.command('add')
.description('Add a contract (and its dependencies) to your flow.json config')
.argument('<contractName>', 'The contract to be added')
.option('-c, --config <config>', 'File location of the config to be edited')
.option('-a, --account <account>', 'Account that will deploy this imported contract', 'emulator-account')
.action((contractName, options) => {
if(!options.config) {
options.config = getDefaultConfigPath()
console.log("no config specified, using default config: ", options.config)
}
add(
{
name: contractName,
...options
})
});
program.command("add-all")
.description("Add all contracts to your flow.json config")
.option('-c, --config <config>', 'File location of the config to be edited')
.option('-a, --account <account>', 'Account to be used for signing', 'emulator-account')
.action(({config, account}) => {
if(!config) {
config = getDefaultConfigPath()
console.log("no config specified, using default config: ", config)
}
addAll(config, account)
})
program.parse(process.argv);