Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created September 9, 2020 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/0527fb79eb213e94f2264dcdf7df6347 to your computer and use it in GitHub Desktop.
Save BetterProgramming/0527fb79eb213e94f2264dcdf7df6347 to your computer and use it in GitHub Desktop.
const {Command, flags} = require('@oclif/command')
const Weight = require('../api/weight')
const weight = new Weight()
class AddCommand extends Command {
async run() {
const {args} = this.parse(AddCommand)
const newWeight = args.weight
weight.add(newWeight)
this.log(`new weight ${newWeight} kg added`)
}
}
AddCommand.description = "add a new record of weight"
AddCommand.args = [{
name: "weight",
description: "current weight in kilograms; insert only the value, omit kg",
required: true
}]
module.exports = AddCommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment