Skip to content

Commit 3ab47ca

Browse files
committed
make --from-contract and --spkg exclusive
1 parent 6290e03 commit 3ab47ca

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

packages/cli/src/commands/init.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class InitCommand extends Command {
6262
description: 'Creates a scaffold based on an example subgraph.',
6363
// TODO: using a default sets the value and therefore requires not to have --from-contract
6464
// default: 'Contract',
65-
exclusive: ['from-contract'],
65+
exclusive: ['from-contract', 'spkg'],
6666
}),
6767

6868
'contract-name': Flags.string({
@@ -143,20 +143,14 @@ export default class InitCommand extends Command {
143143
'The --skip-git flag will be removed in the next major version. By default we will stop initializing a Git repository.',
144144
);
145145
}
146-
if ((!fromContract || !spkgPath) && !network) {
146+
if ((!fromContract || !spkgPath) && !network && !fromExample) {
147147
this.error('--network is required when using --from-contract or --spkg');
148148
}
149149

150150
const { node } = chooseNodeUrl({
151151
node: nodeFlag,
152152
});
153153

154-
if (fromContract && fromExample) {
155-
this.error('Only one of "--from-example" and "--from-contract" can be used at a time.', {
156-
exit: 1,
157-
});
158-
}
159-
160154
// Detect git
161155
const git = system.which('git');
162156
if (!git) {

0 commit comments

Comments
 (0)