Skip to content

About

Command line tool for “Can I Use …” and MDN Browser Compat Data

Topics

Resources

Stars

225 stars

Watchers

4 watching

Forks

 
 

Latest commit

 

History

114 Commits

Folders and files

Repository files navigation

@bramus/caniuse-cli

Command line tool for “Can I Use …” and MDN Browser Compat Data

npm NPM

caniuse-cli screenshot

Features

  • Instant, offline, results powered by caniuse-db, @mdn/browser-compat-data, and web-features.
  • Displays color-coded Baseline status (Widely available, Newly available, or Limited availability).
  • Collapses versions with the same level of support in the table, just like the “Can I Use …” website.
  • Shows notes by number.
  • Supports tab autocompletion in zsh, bash and fish.
  • Built-in --update command to keep the local compatibility databases up to date.

Installation

$ npm install -g @bramus/caniuse-cli

Usage

$ caniuse viewport-units
$ caniuse "viewport units"
$ caniuse @property
$ caniuse --help
$ caniuse --version
$ caniuse --versions

You can also run @bramus/caniuse-cli directly using npx: npx @bramus/caniuse-cli

Options

  • --help (-h): Print the help message and usage instructions.
  • --version (-v): Print the version number of the installed @bramus/caniuse-cli binary.
  • --versions: Print the versions of the local compatibility databases (@mdn/browser-compat-data, caniuse-db, and web-features).
  • --update: Update the local compatibility databases.
  • --completion: Print the shell tab completion script for bash and zsh.
  • --completion-fish: Print the shell tab completion script for fish.

Updating the Compatibility Data

When your local caniuse-db or @mdn/browser-compat-data data is 30 days or older, caniuse will display a reminder to update. You can update the local databases (caniuse-db, @mdn/browser-compat-data, and web-features) at any time by running:

$ caniuse --update

To check which database versions are currently installed, run caniuse --versions.

Enable Tab Autocompletion

In zsh:

echo '. <(caniuse --completion)' >> ~/.zshrc

In bash:

caniuse --completion >> ~/.caniuse.completion.sh
echo 'source ~/.caniuse.completion.sh' >> ~/.bashrc

In fish:

echo 'caniuse --completion-fish | source' >> ~/.config/fish/config.fish

That's all!

Now you have an autocompletion system.

Possible issues

Missing bash-completion package

bash: _get_comp_words_by_ref: command not found
bash: __ltrim_colon_completions: command not found
bash: _get_comp_words_by_ref: command not found
bash: __ltrim_colon_completions: command not found

Solution: install bash-completion package

License

@bramus/caniuse-cli is released under the MIT public license. See the enclosed LICENSE for details.

Acknowledgements

This project is built on the original https://github.com/dsenkus/caniuse-cli/

About

Command line tool for “Can I Use …” and MDN Browser Compat Data

Topics

Resources

Stars

225 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages