Skip to content

Commit

Permalink
limit json flag to ls and updated commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ricky committed May 20, 2017
1 parent e5c5b18 commit ceb1fe0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ $ lerna ls

List all of the public packages in the current Lerna repo.

`lerna ls` respects the `--ignore`, `--scope`, and `--json` flags (see [Flags](#flags)).
`lerna ls` respects the `--ignore` and `--scope` flags (see [Flags](#flags)).

#### --json

Expand Down
13 changes: 0 additions & 13 deletions src/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ export const builder = {
describe: "Set max-buffer(bytes) for Command execution",
type: "number",
requiresArg: true
},
"json": {
describe: dedent`
Returns output as a machine-readable json object
(Only for 'ls' and 'updated' commands)
`,
type: "boolean",
default: false
}
};

Expand All @@ -78,11 +70,6 @@ export default class Command {
log.pause();
log.heading = "lerna";

// Default to silent log level for JSON output
if (flags.json) {
log.level = "silent";
}

if (flags.loglevel) {
log.level = flags.loglevel;
}
Expand Down
8 changes: 7 additions & 1 deletion src/commands/LsCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ export const command = "ls";

export const describe = "List all public packages";

export const builder = {};
export const builder = {
"json": {
describe: "Show information in JSON format",
group: "Command Options:",
type: "boolean"
}
};

export default class LsCommand extends Command {
get requiresGit() {
Expand Down
15 changes: 14 additions & 1 deletion src/commands/UpdatedCommand.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import _ from "lodash";
import chalk from "chalk";

import { builder as publishOptions } from "./PublishCommand";
import Command from "../Command";
import output from "../utils/output";
import UpdatedPackagesCollector from "../UpdatedPackagesCollector";

const updatedOptions = _.assign(
{},
publishOptions,
{
"json": {
describe: "Show information in JSON format",
group: "Command Options:",
type: "boolean"
}
}
);

export function handler(argv) {
return new UpdatedCommand(argv._, argv).run();
}
Expand All @@ -13,7 +26,7 @@ export const command = "updated";

export const describe = "Check which packages have changed since the last publish.";

export const builder = (yargs) => yargs.options(publishOptions);
export const builder = (yargs) => yargs.options(updatedOptions);

export default class UpdatedCommand extends Command {
initialize(callback) {
Expand Down

0 comments on commit ceb1fe0

Please sign in to comment.