Created
September 9, 2020 15:44
-
-
Save BetterProgramming/0527fb79eb213e94f2264dcdf7df6347 to your computer and use it in GitHub Desktop.
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
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