by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 27 23:52
    RasPhilCo labeled #16
  • May 27 23:52
    RasPhilCo commented #16
  • May 27 12:51
    yatryan closed #350
  • May 27 12:51
    yatryan commented #350
  • May 27 12:35
    yatryan opened #350
  • May 26 23:35
    codecov[bot] commented #111
  • May 26 23:33
    codecov[bot] commented #111
  • May 26 23:31
    codecov[bot] commented #111
  • May 26 23:31
    codecov[bot] commented #111
  • May 26 23:31
    moberhauer synchronize #111
  • May 26 22:48
    codecov[bot] commented #111
  • May 26 22:47
    codecov[bot] commented #111
  • May 26 22:46
    codecov[bot] commented #111
  • May 26 22:45
    codecov[bot] commented #111
  • May 26 22:45
    colbymatthiassonpublic synchronize #111
  • May 26 18:48
    SConaway closed #93
  • May 26 18:19
    xavdid closed #57
  • May 26 18:19
    xavdid commented #57
  • May 26 18:13
    RasPhilCo commented #57
  • May 26 18:01
    RasPhilCo commented #93
Donnovan Lewis
@blackdynamo
Thanks Charlie, didn't realize there was a gitter
Charlie Robbins
@indexzero
@jdxcode @samuela PR is up – oclif/config#72
Jeff Dickey
@jdxcode
Whoops I should've caught that
I should be home soon and can merge this
Jeff Dickey
@jdxcode
whoops @piersmacdonald I accidentally "reported" your post
sorry about that
Piers MacDonald
@piersmacdonald
lol, I wondered where it went
np
Jeff Dickey
@jdxcode
I think there are new docs up for table here: https://github.com/oclif/cli-ux#clitable
it's changed a lot in the latest release of cli-ux
Piers MacDonald
@piersmacdonald

This example

    cli.table(users, {
      name: {
        minWidth: 7,
      },
      company: {
        get: row => row.company && row.company.name
      },
      id: {
        header: 'ID',
        extended: true
      }
    }, {
      printLine: this.log,
      ...flags, // parsed flags
    })

doesn't match the signature table(data: any[], inputOptions?: Partial<TableOptions>)

wait, maybe it's me. maybe I need to npm update
1 sec
Piers MacDonald
@piersmacdonald
nope, I think I'm up to date
Piers MacDonald
@piersmacdonald
anyone else get this error when building a windows release 'grep' is not recognized as an internal or external command
Jeff Dickey
@jdxcode
you can't build anything on windows
Piers MacDonald
@piersmacdonald
very good
building it on a linux box now. FYI, it failed because it requires makensis. Would be a good idea to include it as a dependency or document it
samuela
@samuela
what's the recommended way to control the oclif "entrypoint"? in other words, what if i have some code that I want to be run prior to entering any particular command? where does that belong?
Tim Durward
@TimDurward

@samuela Check out ( https://oclif.io/docs/hooks )

  1. init - runs when the CLI is initialized before a command is found to run
  2. prerun - runs after init and after the command is found, but just before running the command itself
  3. command_not_found - runs if a command is not found before the error is displayed You can add custom hooks that you can then invoke within an individual command.

You can also create a custom hook that is invoked on each command you'd like it to run on.
Example:

class HelloCommand extends Command {
  async run() {
    // Custom Hook event (auth:github)
    await this.config.runHook("auth:github");

    const { flags } = this.parse(HelloCommand);
    const name = flags.name || "world";
    this.log(`hello ${name} from ./src/commands/hello.js`);
  }
}
Anyone here know how to swap out the oclif log-driver? I've been wanting to use ( https://github.com/winstonjs/winston ) as the default driver and also customize some of the log-levels. Documentation doesn't really have much detail in this section.
Jeff Dickey
@jdxcode
@TimDurward there isn't really any support for that, but you might be able to require('debug').log = msg => /*do something with msg*/ to redirect the output
Tim Durward
@TimDurward
Thanks I'll try that out @jdxcode
Would you also have any examples for Base Classes in Javascript vs Typescript?
i.e
export default abstract class extends Command {
  static flags = {
    loglevel: flags.string({options: ['error', 'warn', 'info', 'debug']})
  }

  log(msg, level) {
    switch (this.flags.loglevel) {
    case 'error':
      if (level === 'error') console.error(msg)
      break
    // a complete example would need to have all the levels
    }
  }
Jeff Dickey
@jdxcode
base classes in js are basically the same except js doesn't have static properties
Tim Durward
@TimDurward
@jdxcode I understand the static properties portions, but this mysterious abstract is where I'm a little thrown off :laughing:
Mathieu Frenette
@silphid
Hello there! I'm loving oclif up to now! I'm now trying to implement auto-completion, but I can't seem to find any documentation on how to go about it! :-( Any recommendation where to start?
RasPhilCo
@RasPhilCo
@silphid add it as a plugin, then run $ mycli autocomplete and follow the local setup steps.
Anthony Grimmitt
@ant3_gitlab
hey guys
is there away . to read an input stream using oclif i.e. ./bin/run foo < ./data/bar
Anthony Grimmitt
@ant3_gitlab
figure it out
process.stdin
Satya Rohith
@satyarohith
Is there a way to color the output of table?
Jeff Dickey
@jdxcode
@satyarohith you can set the color of each cell individually
Jeff Dickey
@jdxcode
we're moving to spectrum!
please post anything new there. It's more like a forum so it should be easier to follow individual discussions and browse past conversations than a single chat
Satya Rohith
@satyarohith
Thanks @jdxcode, I will look into it.
Tim Durward
@TimDurward
Just when I was about to suggest Slack :laughing:
David Jones
@djones

Hi everyone, I've recently been hitting this error when running tests for our Oclif CLI:

(node:29441) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:280:19)
    at WriteStream.addListener (events.js:297:10)
    at WriteStream.Readable.on (_stream_readable.js:772:35)
    at Snapshot._swallowEPIPE (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:133:24)
    at Snapshot.init (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:67:14)
    at Snapshot._run (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:33:24)
    at Function.Command.run (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:155:16)
    at <anonymous>

You can get the full backtrace there with --trace-warnings turned on. And then after a wee bit of googling I noticed the Heroku CLI has actually been getting the same warnings recently https://ci.appveyor.com/project/heroku/heroku-cli-command/branch/master#L174

Has anyone seen this before? It seems to trace back to here https://github.com/oclif/command/blob/3c0bafd840b663f34286a9b1cb84aaee368a210d/src/command.ts#L178-L182

this looks very relevant too forcedotcom/cli#30
David Jones
@djones
I think it may have been introduced with oclif/command#54 but I'm gonna revert to an older version of @oclif/command and see if that fixes it.
ok, I have reverted to @oclif/command 1.5.10 (which doesn't include PR #54 above) and the warning has gone.
David Jones
@djones
@jdxcode you'll probably be interested in ^ looks like this particular error has not only affected our CLI but the force.com and Heroku CLIs too. oclif/command#54 is the root of the issue.
David Jones
@djones
(ah just saw the message about moving from gitter to spectrum)
Bernie
@twk-b
hiya... i met someone important twice at nodejs events in van, i have some tickets.... yt for oclif...
i thought i was being super awesome and make some clis, but then people said clis are dead, long live irc, i mean slack.... it seemed obvious 2y ago, but i still search and see no oclif-slack, is there some other secret sauce?
anyone know of some glue? im using botkit to build eggdrops ;)
Paul Bruno
@paulbruno_gitlab
Hey, gang... having such fun with oclif thus far! But... trying to build a standalone binary of my CLI tool, and can't seem to get pkg to correctly package up my (seemingly quite simple) CLI.
Jan Peters
@Jan-Solo_gitlab
Hi, I am new to Oclif, I got my first few commands in for a multicommand setup, the seem to work as intended with npm link.
Now I have to build a .deb for it. The build seems to work but when I install it on my machine, none of my commands are there.. Is there somewhere I have to define that it has to look into ./src/commands?
ritwizsinha
@ritwizsinha
Hello all, I was trying to take passwords as input in the same way bash does it, do I have some way of doing that in oclif or should I use the stdins and stdouts for this ?
ritwizsinha
@ritwizsinha
Nevermind found inquirer