Skip to content
Myr

action-this.js

This file

Path

examples/action-this.js

19 lines · 479 bytes · JavaScript

Last changed by

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

History of this file

Take it

The walk stopped after 200 commits: lines older than 3103c6b point at it.

Add more tests for implies (#1730)John Geebefore adoption3103c6b

lines 1–4why, one step back
1#!/usr/bin/env node
23// This example is used as an example in the README for the action handler.4

Use standard import in examples (#2168)John Geebefore adoption41b12cf

line 5why, one step back
5const { Command } = require('commander');

Add more tests for implies (#1730)John Geebefore adoption3103c6b

lines 6–11why, one step back
6const program = new Command();
78program9 .command('serve')10 .argument('<script>')11 .option('-p, --port <number>', 'port number', 80)

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 12why, one step back
12 .action(function () {

Add more tests for implies (#1730)John Geebefore adoption3103c6b

lines 13–19why, one step back
13 console.error('Run script %s on port %s', this.args[0], this.opts().port);
14 });1516program.parse();1718// Try the following:19// node action-this.js serve --port 8080 index.js