Bower输出采用JSON格式

时间:2021-06-28 14:06:01

Every time what I do with Bower Tool I get output in json format.

每次使用Bower Tool我都会以json格式输出。

For Example:

**bower help **

**凉亭帮助**

output in cosole:

cosole输出:

{
  "usage": [
    "<command> [<args>] [<options>]"
  ],
  "commands": {
    "cache": "Manage bower cache",
    "help": "Display help information about Bower",
    "home": "Opens a package homepage into your favorite browser",
    "info": "Info of a particular package",
    "init": "Interactively create a bower.json file",
    "install": "Install a package locally",
    "link": "Symlink a package folder",
    "list": "List local packages - and possible updates",
    "login": "Authenticate with GitHub and store credentials",
    "lookup": "Look up a package URL by name",
    "prune": "Removes local extraneous packages",
    "register": "Register a package",
    "search": "Search for a package by name",
    "update": "Update a local package",
    "uninstall": "Remove a local package",
    "unregister": "Remove a package from the registry",
    "version": "Bump a package version"
  },
  "options": [
    {
      "shorthand": "-f",
      "flag": "--force",
      "description": "Makes various commands more forceful"
    },
    {
      "shorthand": "-j",
      "flag": "--json",
      "description": "Output consumable JSON"
    },
    {
      "shorthand": "-l",
      "flag": "--loglevel",
      "description": "What level of logs to report"
    },
    {
      "shorthand": "-o",
      "flag": "--offline",
      "description": "Do not hit the network"
    },
    {
      "shorthand": "-q",
      "flag": "--quiet",
      "description": "Only output important information"
    },
    {
      "shorthand": "-s",
      "flag": "--silent",
      "description": "Do not output anything, besides errors"
    },
    {
      "shorthand": "-V",
      "flag": "--verbose",
      "description": "Makes output more verbose"
    },
    {
      "flag": "--allow-root",
      "description": "Allows running commands as root"
    },
    {
      "shorthand": "-v",
      "flag": "--version",
      "description": "Output Bower version"
    },
    {
      "flag": "--no-color",
      "description": "Disable colors"
    }
  ]
}

but result should looks like this https://theenlighteneddeveloper.files.wordpress.com/2013/12/capture-d_c3a9cran-2013-12-08-c3a0-22-32-47.png

但结果应如下所示https://theenlighteneddeveloper.files.wordpress.com/2013/12/capture-d_c3a9cran-2013-12-08-c3a0-22-32-47.png

That problem occurs with each bower commands.

每个bower命令都会出现这个问题。

Bower version: 1.7.9 NPM version: 1.3.10 Ubuntu 14.04

Bower版本:1.7.9 NPM版本:1.3.10 Ubuntu 14.04

Anybody knows how to change for more pleasant format for human?

谁知道如何改变人类更愉快的格式?

Thanks in advance

提前致谢

1 个解决方案

#1


16  

In version 1.7.9 introduce some change.

在1.7.9版本中引入了一些更改。

My .bowerrc looks like:

我的.bowerrc看起来像:

{
    "directory": "bower_components",
    "json": "bower.json"
}

I removed "json": "bower.json" line and problem solved.

我删除了“json”:“bower.json”行,问题解决了。

#1


16  

In version 1.7.9 introduce some change.

在1.7.9版本中引入了一些更改。

My .bowerrc looks like:

我的.bowerrc看起来像:

{
    "directory": "bower_components",
    "json": "bower.json"
}

I removed "json": "bower.json" line and problem solved.

我删除了“json”:“bower.json”行,问题解决了。