Skip to content

Commit

Permalink
feat: some progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed Nov 14, 2022
1 parent f1e506d commit 9ca0aac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
"@web3-storage/upload-client": "workspace:^",
"conf": "^10.1.2",
"files-from-path": "^0.2.6",
"inquirer": "^9.1.4",
"ora": "^6.1.2",
"sade": "^1.7.4"
},
"devDependencies": {
"@types/inquirer": "^9.0.2",
"@types/node": "^18.11.7"
}
}
3 changes: 1 addition & 2 deletions packages/cli/src/cmd-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import fs from 'fs'
import path from 'path'
import { uploadFile, uploadDirectory, delegateCapabilities } from '@web3-storage/upload-client'
import { Agent } from '@web3-storage/access'
import { getService } from '@web3-storage/access/cli/utils'
import { StoreConf } from '@web3-storage/access/stores/store-conf'
import ora from 'ora'
import { filesFromPath } from 'files-from-path'
Expand All @@ -28,7 +27,7 @@ export async function cmdUpload (firstPath, opts) {

const exists = await store.exists()
if (!exists) {
console.error('run setup command first.')
console.error('run account create command first.')
process.exit(1)
}

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export const pkg = JSON.parse(
)

export const NAME = pkg.name.split('/').pop()

export const SERVICE_URL = new URL(process.env.SERVICE_URL ?? 'https://w3access-staging.protocol-labs.workers.dev')
17 changes: 5 additions & 12 deletions packages/cli/src/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
#!/usr/bin/env node
import sade from 'sade'
import { cmdSetup } from '@web3-storage/access/cli/cmd-setup'
import { cmdCreateAccount } from '@web3-storage/access/cli/cmd-create-account'
import { NAME, pkg } from './config.js'
import { cmdAccountRegister } from './cmd-account-create.js'
import { cmdUpload } from './cmd-upload.js'

const prog = sade(NAME)

prog
.version(pkg.version)
.option('--env', 'Env', 'staging')
.option('--profile', 'Profile to use', 'main')

prog
.command('setup')
.option('--reset', 'Reset current store.', false)
.describe('Setup the web3.storage CLI tool.')
.action(cmdSetup)

prog
.command('account create')
.describe('Create a new account.')
.action(cmdCreateAccount)
.command('account register <email>')
.describe('Register a new account.')
.action(cmdAccountRegister)

prog
.command('upload <path>')
Expand Down
4 changes: 4 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ca0aac

Please sign in to comment.