/src
└── cli.tsx: Calls "yargs.commandDir('./rootCmds')" to configure top-level command
└── /rootCmds:
| └── api.tsx: This cmd calls `yargs.commandDir()` on each of the dirs below
| └── /authCmds
| | └── beginPassReset.tsx: "dappbot api auth/beginPassReset" will send a password reset request
| | └── ...
| └── /privateCmds
| | └── createDapp.tsx: "dappbot api private/createDapp <...args>" will create a Dapp
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
{ | |
"name": "@eximchain/dappbot-cli", | |
"bin": { | |
"dappbot": "build/cli.js" | |
}, | |
"..." : "..." | |
} |
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
import { SuccessBox } from '../ui'; | |
export function handler(args:ArgShape<DappNameArg>) { | |
const { DappName, hubUrl } = args; | |
const url = `${hubUrl}/${DappName}`; | |
render( | |
<SuccessBox result={{ | |
message: `Opening ${url} now!` | |
}} /> |
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
... | |
export function handler(args:ArgShape<DappNameArg>) { | |
const { DappName, hubUrl } = args; | |
const url = `${hubUrl}/${DappName}`; | |
// Each and every handler function has a | |
// render call like this one. | |
render( |
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
export const command = 'lorem <arg1> <arg2>'; | |
export const desc = 'This cmd description is ipsum'; | |
export function builder(yargs) { | |
// Add addt'l command configuration | |
} | |
export function handler(argv) { | |
// Use parsed argv to perform any actions desired |
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
yargs.command( | |
'lorem <arg1> <arg2>', | |
'This cmd description is ipsum.', | |
function(yargs) { | |
// Builder: Perform addt'l command configuration | |
}, | |
function(argv) { | |
// Handler: When user correctly calls this cmd, this fxn will receive the parsed opstring | |
} | |
); |
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
// Stuttering | |
const args: AuthMethods.LoginMethod.LoginArgs = { ... }; | |
// No stuttering | |
const args: Auth.Login.Args = { ... }; |
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
{ | |
"main" : "../../build/user/index.js", | |
"types": "./index.ts" | |
} |
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 line takes all of the exports from that | |
// file and wraps them into a single namespace. | |
// If we didn't do this "* as User" syntax here, | |
// then a consumer would have to do it in order | |
// to get a convenient namespace. | |
import * as User from './user'; | |
// This line directly surfaces all of its non-default | |
// exports from right here, so that users can just | |
// grab one item from there, e.g.: |