Coder Social home page Coder Social logo

yarn-completions's Introduction

yarn-completions

tabtab completion handler for Yarn. Supports bash, zsh or fish.


Install

with npm

npm i -g yarn-completions

On install, the package will add a line to source a SHELL specific config file, into either ~/.bashrc, ~/.zshrc or ~/.config/fish/config.fish.

On uninstall, these lines will be removed.

npm uninstall yarn-completions -g

with yarn

yarn global add yarn-completions

Uninstall, with

yarn global remove yarn-completions

Description

Example of completion results for zsh:

list all available commands and flags

$ yarn
config               clean            check      cache
dedupe               prune            help
generate-lock-entry  global           init       info
--global-folder      access           bin        add
licenses             install          login      link
lockfile             version          upgrade    why
outdated             logout           owner      ls
--prefer-offline     --strict-semver  --offline  --json
publish              remove           pack       run
self-update          unlink           team       tag     --
--help               -h                                  -- output usage information
--modules-folder                                         -- rather than installing modules into the node_modules folder relat
--mutex                                                  -- use a mutex to ensure only one yarn instance is executing
--packages-root                                          -- rather than storing modules into a global packages root, store th
--version            -V                                  -- output the version number

list subcommands and command specific option

$ yarn global
--global-folder   --strict-semver  --json
--prefer-offline  --offline        remove  bin  add  ls  --
--help            -h                                     -- output usage information
--modules-folder                                         -- rather than installing modules into the node_modules folder relat
--mutex                                                  -- use a mutex to ensure only one yarn instance is executing
--packages-root                                          -- rather than storing modules into a global packages root, store th
--version         -V                                     -- output the version number

$ yarn install
--flat                                                         -- only allow one version of a package
--global-folder    --json
--ignore-optional  --ignore-scripts  --force        --prod
--prefer-offline   --strict-semver    --production  --offline  --
--har                                                          -- save HAR output of network traffic
--help             -h                                          -- output usage information
--ignore-engines                                               -- ignore engines check
--modules-folder                                               -- rather than installing modules into the node_modules folder
--mutex                                                        -- use a mutex to ensure only one yarn instance is executing
--no-lockfile                                                  -- don't read or generate a lockfile
--packages-root                                                -- rather than storing modules into a global packages root, st
--pure-lockfile                                                -- don't generate a lockfile
 --save            -S                                          -- DEPRECATED - save package to your `dependencies`
 --save-dev        -D                                          -- DEPRECATED - save package to your `devDependencies`
 --save-exact       --global         -E             -g
 --save-tilde      -T                                          -- DEPRECATED
 --save-optional   -O                                          -- DEPRECATED - save package to your `optionalDependencies`
 --save-peer       -P                                          -- DEPRECATED - save package to your `peerDependencies`
--version          -V                                          -- output the version number

Some commands have more granular completion handlers defined in their own completion file (in lib/completions). Slightly more elaborated completion handlers may be developed for each specific command that would make sense.

yarn config get or yarn config set

$ yarn config set
ignore-optional      ignore-scripts    save-prefix
user-agent           registry
version-git-message  init-license      init-version
version-tag-prefix   version-git-sign  version-git-tag  --

yarn run that completes with package.json's script fields for instance.

$ yarn run
postuninstall  postinstall  prepublish  babel  test
watch                                                --

yarn link completes based off the links found in ~/.yarn-cache/.link.

$ yarn link
yarn-completions  tiny-lr  tabtab  --

yarn unlink completes based off the links found in node_modules folder, and the one found in ~/.yarn-cache/.link

$ yarn unlink
tabtab    --

yarn outdated completes based off dependencies and devDependencies found in project's package.json

$ yarn outdated
babel-preset-es2015  npm-watch  babel-cli  yarn
lodash.intersection  user-home  tabtab     lodash  --

same goes for yarn remove, completing based off dependencies and devDependencies found in project's package.json

$ yarn remove
babel-preset-es2015  npm-watch  babel-cli  yarn
lodash.intersection  user-home  tabtab     lodash  --

yarn why completes all packages found in node_modules folder.

$ yarn why babel-
babel-code-frame                                      babel-cli
babel-generator                                       babel-core
babel-helper-call-delegate                            babel-helper-define-map
babel-helper-get-function-arity                       babel-helper-function-name
babel-helper-optimise-call-expression                 babel-helper-hoist-variables
babel-helper-replace-supers                           babel-helper-regex
babel-messages                                        babel-helpers
babel-plugin-transform-es2015-arrow-functions         babel-plugin-check-es2015-constants
babel-plugin-transform-es2015-block-scoped-functions  babel-plugin-transform-es2015-block-scoping
babel-plugin-transform-es2015-computed-properties     babel-plugin-transform-es2015-classes
babel-plugin-transform-es2015-duplicate-keys          babel-plugin-transform-es2015-destructuring
babel-plugin-transform-es2015-function-name           babel-plugin-transform-es2015-for-of
babel-plugin-transform-es2015-modules-amd             babel-plugin-transform-es2015-literals
babel-plugin-transform-es2015-modules-systemjs        babel-plugin-transform-es2015-modules-commonjs
babel-plugin-transform-es2015-object-super            babel-plugin-transform-es2015-modules-umd
babel-plugin-transform-es2015-shorthand-properties    babel-plugin-transform-es2015-parameters
babel-plugin-transform-es2015-sticky-regex            babel-plugin-transform-es2015-spread
babel-plugin-transform-es2015-template-literals       babel-plugin-transform-es2015-typeof-symbol
babel-plugin-transform-inline-imports-commonjs        babel-plugin-transform-es2015-unicode-regex
babel-plugin-transform-strict-mode                    babel-plugin-transform-regenerator
babel-preset-es2015                                   babel-polyfill
babel-register                                        babel-runtime
babel-traverse                                        babel-template
babel-types

yarn-completions's People

Contributors

curtiswilkinson avatar josephfrazier avatar mklabs avatar xavier-calland 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

yarn-completions's Issues

Wrong yarn cache folder on Mac

The yarn cache folder is hardcoded to ~/.yarn-cache, but on OS X, yarn defaults the cache to ~/Library/Caches/Yarn.

You can obtain the cache folder by running yarn cache dir. There's no ~/Library/Caches/Yarn/.link either - I have no idea how yarn does links on OS/X.

Installation issue

Hi @Matmo10

I thought about adding an issue here to maybe help you get yarn-completions work on your system. I hope you'll get this notification :)

Based on that comment: yarnpkg/yarn#609 (comment)

I installed yarn-completions - didn't work. Realized it's actually some kind of plugin for tabtab, so I installed that. Still doesn't work. Re-sourced my bash profile. Still doesn't work. Is there really more configuration required?

How did you install yarn-completions ? You don't need to install tabtab separately, this is included in yarn-completions itself.

Normally, you just need to install yarn-completions with npm globally.

npm install yarn-completions -g

What do you use for your shell ? Bash, zsh or fish ? If you use bash, you should see a line specific to tabtab, at the end of your ~/.bashrc, that loads a shell specific script for your system and enable the completion mechanism for the command yarn.

yarn add autocomplete errors

yarn add [tab key] yields the following error:

throw err;
    ^

Error: Cannot find module 'got'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/samhh/.yarn-config/global/node_modules/yarn-completions/src/completions/add.js:3:11)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)

Source command is incorrect for zsh

I am using zsh and upon install, this was inserted into my zshrc:

[[ -f path ]] && . path

However, spaces in the path were not escaped, so it errored.

Perhaps it should become:

[[ -f "path" ]] && . "path"

Doesn't work

After installing globally using:
npm i -g yarn-completions

then typing yarn + tab shows:

yarn module.js:457
    throw err;
    ^

Error: Cannot find module '../src/cli'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/adcaballero/.nvm/v6.6.0/lib/node_modules/yarn-completions/bin/yarn-completions.js:3:1)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
module.js:457
    throw err;
    ^

Scripts with ':' aren't tab completed

Installed, worked as expected for the most part.

Scripts like test work fine. Scripts like test:unit or test:integration don't appear at all.

I tried with the latest version and checked out master, it didn't work either.

doesn't work for me too

I downloaded it with 'yarn global add' but it doesn't seem to work.

Writing yarn and pressing tab I get this :

readme.md

It's a package for Yarn but you provide instructions for npm too?

image

Umad?

yarn add completion

yarn add create-<tab>
=> list of completion results from registry

Have to rely on external search services similar to npmsearch or npmsio. Most of the results should be cached in some way.

Tested in numerous times, but never ended up with results that felt fast / robust enough to publish it.

/usr/bin/completions-yarn symlink is broken

After npm or yarn install of yarn-completions, /usr/bin/completions-yarn points to /usr/lib/node_modules/yarn-completions, which is not there.

It works after:
sudo ln -fs ~/.yarn-config/global/node_modules/yarn-completions/bin/yarn-completions.js /usr/bin/completions-yarn

command not found: completions-yarn

Upon install with yarn global add yarn-completions I get the following written in my .zshrc

[[ -f /Users/martin/.npm-packages/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh ]] && . /Users/martin/.npm-packages/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh

However when I type in terminal "yarn " and hit tab I get the following:
yarn _yarn_completion:4: command not found: completions-yarn _yarn_completion:4: command not found: completions-yarn _yarn_completion:4: command not found: completions-yarn yarn

Does not working in Zsh

There is no ~/.config/yarn/global/node_modules/tabtab/.completions/yarn.zsh after installation.

thank you! <3 <3

me finding my way here
image

everything is great and i was so looking forward to this to help with completions for the scripts. (we have one and i can never remember if its core-unit or unit-core..). Now i'm good. :)

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.