-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(agoric-cli): clarify flow of inputs to outputs in start.js (WIP) #6698
Draft
dckc
wants to merge
13
commits into
master
Choose a base branch
from
dc-cli-ocap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+853
−334
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
175e797
refactor(access-token): makeMyAgoricDir follows OCap Discipline
dckc 4f16f0f
refactor(agoric-cli): move 'open' CLI details to open.js
dckc efd0e91
refactor(agoric-cli): subMain -> procExit
dckc 618df1d
refactor(agoric-cli): move CLI details to init.js
dckc f5c3603
refactor(agoric-cli): push set-default CLI details down
dckc 655df16
refactor(agoric-cli): push follow details down
dckc c0938b5
refactor(agoric-cli): move start CLI options to start.js
dckc f2fa44d
test(agoric-cli): one test for 'agoric start'
dckc d40b034
test(agoric-cli): agoric start with no install
dckc a2e76f6
chore(agoric-cli): POLA-shaped file IO
dckc 13f49e3
chore(agoric-cli): explicit access to path
dckc a40c541
refactor(agoric-cli): factor out startFakeChain
dckc 7f8b8b3
test(agoric-cli): agoric start --reset
dckc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,13 @@ import { makePspawn } from './helpers.js'; | |
import '@endo/captp/src/types.js'; | ||
import '@agoric/swingset-vat/exported.js'; | ||
import '@agoric/swingset-vat/src/vats/network/types.js'; | ||
import commander from 'commander'; | ||
|
||
const { Command } = commander; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, |
||
|
||
const DEFAULT_DAPP_TEMPLATE = 'dapp-fungible-faucet'; | ||
const DEFAULT_DAPP_URL_BASE = 'https://github.com/Agoric/'; | ||
const DEFAULT_DAPP_BRANCH = undefined; | ||
|
||
// Use either an absolute template URL, or find it relative to DAPP_URL_BASE. | ||
const gitURL = (relativeOrAbsoluteURL, base) => { | ||
|
@@ -17,6 +24,26 @@ const gitURL = (relativeOrAbsoluteURL, base) => { | |
return url.href; | ||
}; | ||
|
||
export const makeInitCommand = () => | ||
new Command('init') | ||
.description('create a new Dapp directory named <project>') | ||
.arguments('<project>') | ||
.option( | ||
'--dapp-template <name>', | ||
'use the template specified by <name>', | ||
DEFAULT_DAPP_TEMPLATE, | ||
) | ||
.option( | ||
'--dapp-base <base-url>', | ||
'find the template relative to <base-url>', | ||
DEFAULT_DAPP_URL_BASE, | ||
) | ||
.option( | ||
'--dapp-branch <branch>', | ||
'use this branch instead of the repository HEAD', | ||
DEFAULT_DAPP_BRANCH, | ||
); | ||
|
||
export default async function initMain(_progname, rawArgs, priv, opts) { | ||
const { anylogger, spawn, fs } = priv; | ||
const log = anylogger('agoric:init'); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to using
Command
. though with it, this file should go insrc/commands
. You might want do the Commander refactorings in a separate PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm... using
src/commands
seems to be the exception, not the rule.main.js
looks like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on how you look at it. What I am requesting is that files that import the
Command
class (and export an instance of it) go insrc/commands
. There are 4 examples of that in master. The one exception insrc
issrc/main.js
which is making the program. That's cool.These others are not command instances:
And these in your snippet actually are Commands, but ones you're making in this PR:
So I'm requesting that they go with the other Command objects in
src/commands
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't plan to export an instance of
Command
; I plan to export a maker function that takes the necessary authority as args and creates aCommand
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my impression: exporting a maker function that returns an instance of
Command
. That's whatcreateFollowCommand
is, right? That's also what these are:agoric-sdk/packages/agoric-cli/src/commands/psm.js
Line 59 in f1ff7b9
agoric-sdk/packages/agoric-cli/src/commands/perf.js
Line 26 in f1ff7b9
agoric-sdk/packages/agoric-cli/src/commands/oracle.js
Line 20 in f1ff7b9
agoric-sdk/packages/agoric-cli/src/commands/wallet.js
Line 31 in f1ff7b9
When you wrote "seems to be the exception, not the rule" I took it that you were appealing to precedent. The for functions like you describe (returning a Command instance) is that all four of them are in
src/commands
. It seems important to you that you don't put those files insrc/commands
. I don't understand why but I'll wait for R4R before engaging on the topic again in this PR.