Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 07 05:13
    typhonrt edited #521
  • Mar 07 05:05
    typhonrt edited #223
  • Mar 07 05:03
    typhonrt edited #223
  • Mar 07 04:54
    typhonrt closed #222
  • Mar 07 04:54
    typhonrt commented #222
  • Mar 07 04:36
    typhonrt edited #521
  • Mar 07 04:35
    typhonrt edited #222
  • Mar 07 04:32
    codecov[bot] commented #223
  • Mar 07 04:32
    salesforce-cla[bot] labeled #223
  • Mar 07 04:32
    typhonrt opened #223
  • Mar 07 04:28
    typhonrt closed #221
  • Mar 07 04:28
    typhonrt commented #221
  • Mar 05 12:49
    jtushman closed #523
  • Mar 05 12:49
    jtushman commented #523
  • Mar 05 08:33
    rthangam opened #524
  • Mar 04 22:39
    typhonrt edited #222
  • Mar 04 22:38
    typhonrt edited #521
  • Mar 04 22:37
    typhonrt edited #221
  • Mar 04 21:31
    typhonrt edited #221
  • Mar 04 20:55
    typhonrt edited #521
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
bjwswang
@bjwswang
hi guys , just ran into issue [MODULE_NOT_FOUND] Error Plugin: stem-cli
anyone knows why ?
I developed a new package which i hope to use in my project with npm install. The IDE says no errors , but when I run ./bin/run, it failes with MODULE_NOT_FOUND
Charles J Perry
@perryc85
Hello all, I am new to Oclif. I Have a general question. To use it, do you have to have your logic already working and ready to execute before creating a command?
Also, are there any good tutorials I can look at? Thanks in advance. :)
Minu Francis
@francisminu
Hi
Has anyone integrated Yeoman with oclif command? I tried following the pattern used in oclif, but that is throwing a circular dependance
Jeramy
@xylesoft
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
It's back again.