Giter VIP home page Giter VIP logo

caniuse-cmd's Introduction

caniuse-cmd

Just what you've always wanted, it's a caniuse command line tool! All the power of caniuse.com with none of the nice UI or interactivity!

How do?

Install with npm install -g caniuse-cmd.

Then type things like this:

$ caniuse websockets
Web Sockets ✔ 85.22% ◒ 1.35% [W3C Candidate Recommendation]
  Bidirectional communication technology for web apps #JSAPI

  IE ✘ 5.5+ ✔ 10+
  Firefox ✘ 2+ ◒ 4+¹ ◒ 6+ᵖ² ✔ 11+
  Chrome ◒ 4+¹ ◒ 15+² ✔ 16+
  Safari ✘ 3.1+ ◒ 5+¹ ◒ 6+² ✔ 7+
  Opera ✘ 9+ ◒ 11+¹ ✔ 12.1+

    ¹Partial support refers to the websockets implementation using an older version of the protocol and/or the
    implementation being disabled by default (due to security issues with the older protocol).
    ²Partial support refers to lacking support for binary data.

(The output has truly marvellous colours that this markdown is too narrow to contain.)

Or this:

$ caniuse input
caniuse input
HTML5 form features ✔ 4.21% ◒ 82.39%
  IE ✘ 5.5+ ◒ 10+ Firefox ✘ 2+ ◒ 4+ Chrome ◒  Safari ✘ 3.1+ ◒ 4+ Opera ✔ 9+ ◒ 15+
Spellcheck attribute ✔ 60.31% ◒ 31.63%
  IE ✘ 5.5+ ✔ 10+ Firefox ✔  Chrome ✘ 4+ ✔ 9+ Safari ✘ 3.1+ ✔ 5.1+ Opera ✘ 9+ ✔ 10.5+
Range input type ✔ 87.46% ◒ 1.18%
  IE ✘ 5.5+ ✔ 10+ Firefox ✘ 2+ ✔ 23+ Chrome ‽ 4+ ✔ 5+ Safari ✔  Opera ✔
Date and time input types ✔ 60.76% ◒ 0%
  IE ✘  Firefox ✘  Chrome ✘ 4+ ✔ 20+ Safari ✘  Opera ✔
Color input type ✔ 60.93% ◒ 3.84%
  IE ✘  Firefox ✘ 2+ ✔ 29+ Chrome ✘ 4+ ✔ 20+ Safari ✘  Opera ✘ 9+ ✔ 11+ ✘ 15+ ✔ 17+
Number input type ✔ 49.95% ◒ 38.03%
  IE ✘ 5.5+ ◒ 10+ Firefox ✘ 2+ ✔ 29+ Chrome ✘ 4+ ✔ 6+ Safari ✘ 3.1+ ✔ 5+ Opera ✔
input placeholder attribute ✔ 88.04% ◒ 1.15%
  IE ✘ 5.5+ ✔ 10+ Firefox ✘ 2+ ✔ 4+ Chrome ✔  Safari ◒ 3.1+ ✔ 5+ Opera ✘ 9+ ◒ 11+ ✔ 11.5+
Pointer events ✔ 8.5% ◒ 1.67%
  IE ✘ 5.5+ ◒ 10+ᵖ ✔ 11+ Firefox ✘  Chrome ✘  Safari ✘ 3.1+ ‽ 6.1+ Opera ✘
Web Speech API
  IE ✘  Firefox ✘  Chrome ✘ 4+ ◒ 25+ᵖ Safari ✘ 3.1+ ◒ 6.1+ᵖ ◒ 7.1+ Opera ✘
Multiple file selection ✔ 67.63% ◒ 0%
  IE ✘ 5.5+ ✔ 10+ Firefox ✘ 2+ ✔ 3.6+ Chrome ✘ 4+ ✔ 5+ Safari ✘ 3.1+ ✔ 4+ Opera ✘ 9+ ✔ 10.6+
Gamepad API ✔ 46.08% ◒ 0%
  IE ✘  Firefox ✘ 2+ ✔ 29+ Chrome ✘ 4+ ✔ 21+ᵖ ✔ 25+ Safari ✘  Opera ✘ 9+ ✔ 24+
Pattern attribute for input fields ✔ 72.88% ◒ 0.7%
  IE ✘ 5.5+ ✔ 10+ Firefox ✘ 2+ ✔ 4+ Chrome ✘ 4+ ✔ 10+ Safari ✘  Opera ✘ 9+ ✔ 9.5-9.6+

Does it have lots of command line options?

Yes!

$ caniuse --help
Options:
Options:
  --short, -s            Short output: show browsers on one line and don't
                         display notes or description (default when displaying
                         multiple results)                             [boolean]
  --long, -l             Long output: show more information (default when
                         displaying a single result)                   [boolean]
  --oneline, -1          One-line output: just global percentages, no per-
                         browser info                 [boolean] [default: false]
  --oneline-browser, -2  One-line output with browser info, implies --abbrev and
                         --current                    [boolean] [default: false]
  --abbrev, -a           Abbreviate browser names     [boolean] [default: false]
  --percentages, -p      Include browser version usage percentages
                                                      [boolean] [default: false]
  --future, -f           Include future browser versions
                                                      [boolean] [default: false]
  --current, -c          Don't include old browser versions, equivalent to --era
                         e0                           [boolean] [default: false]
  --era, -e              How many versions back to go, e0 to e-40       [string]
  --mobile, -m           Include mobile browsers      [boolean] [default: false]
  --desktop, -d          Include desktop browsers      [boolean] [default: true]
  --browser, -b          Show results for these browsers, comma-separated (ie,
                         edge,firefox,chrome,safari,opera,ios_saf,op_mini,
                         android,bb,op_mob,and_chr,and_ff,ie_mob,and_uc)
                                                                        [string]
  --web, -w              Go to the search page on caniuse.com
                                                      [boolean] [default: false]
  --config, -C           Path to JSON config file
                                 [string] [default: "/Users/user/.caniuse.json"]
  --ascii, -A            UTF-8 symbols replacement with ASCII description
                                                      [boolean] [default: false]
  --help                 Show help                                     [boolean]

Woah, that's a lot of options! Can haz config file?

Yes! You can specify your own defaults by creating a file called .caniuse.json and putting it in your home directory.

For example, if you're primarily interested in mobile browsers two versions back:

{
  "era": "e-2",
  "mobile": true,
  "desktop": false
}

caniuse-cmd's People

Contributors

adrianocahete avatar blindlybright avatar davidsawyer avatar mdawaffe avatar sgentle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caniuse-cmd's Issues

Note supers are hard to spot

The supers for notes are the same color as the percentage to which they belong making them hard to see. It would be nice if they were all a consistent color (not the red/yellow/green) so I could see the note, and spot which version it applies to easily.

caniuse let example

Can I configure a usage threshold?

Era is great, but I'd love to be able to only display browsers and usage percentage for only those browser above 1% or some other configurable threshold.

Just a feature idea : )

Add a config file

It would be great to have a ~/.caniuse file to specify my default options. For example, I'm generally interested in --era e2.

Partial Support Percentage Not Always Shown

If there are no browsers that fully support a feature and at least one browser that partially supports the feature, that partial support percentage is not shown.

Compare the actual output:

# only full, no partial
$ caniuse --oneline hidden
hidden attribute ✔ 92.16% ◒ 0% [WHATWG Living Standard]

# full and partial
$ caniuse --oneline spellcheck
Spellcheck attribute ✔ 54.57% ◒ 39.3% [WHATWG Living Standard]

# no full, only partial
$ caniuse --oneline 'svg favicon'
SVG favicons  [WHATWG Living Standard]

# no support
$ caniuse --oneline placeholder-shown
:placeholder-shown CSS pseudo-class  [W3C Working Draft]

with the expected:

# only full, no partial
$ caniuse --oneline --current hidden
hidden attribute ✔ 92.16% [WHATWG Living Standard]

# full and partial
$ caniuse --oneline spellcheck
Spellcheck attribute ✔ 54.57% ◒ 39.3% [WHATWG Living Standard]

# no full, only partial
$ caniuse --oneline 'svg favicon'
SVG favicons ◒ 10.41% [WHATWG Living Standard]

# no support
$ caniuse --oneline placeholder-shown
:placeholder-shown CSS pseudo-class  [W3C Working Draft]

It looks like there's a typo in showFeature:

diff --git a/caniuse.coffee b/caniuse.coffee
index f5f5050..48f9dff 100644
--- a/caniuse.coffee
+++ b/caniuse.coffee
@@ -150 +150 @@ showFeature = (result, opts={}) ->
-  percentages.push "◒ #{result.usage_perc_a}%".yellow if result.usage_perc_y
+  percentages.push "◒ #{result.usage_perc_a}%".yellow if result.usage_perc_a

Or perhaps this is all intentional (only show the percentages if there's something that fully supports the feature), in which case close away :)

Show the latest browser versions

If I see that Chrome 24 partially supports for a feature, I might think that's relevant unless I see that the latest version of Chrome is 47 😅

Maybe something like this:

Chrome ✘ 4+ ◒ 8+¹ ◒ 23+² ✔ 24+ … 47

Rewrite the whole project in vanilla JavaScript

Sorry but I have to ask about that. As you know, nowadays CoffeeScript is pretty outdated. Want to help out, create pull requests but those CoffeeScript lines makes me really sick (there is no reason to learn that in 2017) and I am quite really sure there are plenty amount of people who don't want to write CoffeeScript. So, converting the project vanilla JavaScript will increase potential contributors.

Result for multiple features

Is it possible to search for multiple features?
e.g. Is it possible to node .\bin.js async-functions,object-values

Error Installing caniuse-cmd

Hi,

I'm running Pop 22.04 with ZSH. I've tried running npm install -g caniuse-cmd and sudo npm install -g caniuse-cmd but I am getting installation error messages -

sudo npm install -g caniuse-cmd                                                                
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects clone -b config-booleans ssh://[email protected]/sgentle/yargs.git /root/.npm/_cacache/tmp/git-cloneJvCgYn --recurse-submodules --depth=1
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-cloneJvCgYn': Permission denied

I've npm 8.13.2

Is custom version of yargs still required?

This project uses a fork of yargs with a config-booleans branch.

"yargs": "git+https://github.com/sgentle/yargs.git#config-booleans"

It looks like the new yargs-parser has changes related to default booleans, and this fork may no longer be required.


Snippet of some of the changes:

https://github.com/sgentle/yargs/blob/7be15b84049f00e6a0c11827c5b16496aeaddd19/lib/parser.js#L316..L344

    Object.keys(flags.configs).forEach(function (configKey) {
...
            // setting arguments via CLI takes precedence over
            // values within the config file.
            if (argv[key] === undefined || (flags.defaulted[key])) {
              delete argv[key]
              setArg(key, config[key])
            }
          })
        } catch (ex) {
          if (argv[configKey]) error = Error(__('invalid json config file: %s', configPath))
        }
      }
    })
  }

Snippet of some of current yargs-parser code:

https://github.com/yargs/yargs-parser/blob/82f4ea5810ca36dbe934de593eb0d45cdcc724c2/index.js#L498..L519

    Object.keys(config).forEach(function (key) {
...
        // setting arguments via CLI takes precedence over
        // values within the config file.
        if (!hasKey(argv, fullKey.split('.')) || (flags.defaulted[fullKey]) || (flags.arrays[fullKey] && configuration['combine-arrays'])) {
          setArg(fullKey, value)
        }
      }
    })
  }

Provide License

I couldn't find a license with this code. Could you add an open source license? I recommend MIT.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.