39 questions
0
votes
0
answers
36
views
How to make an Oclif command the default command when using explicit command strategy?
I'm building a CLI using Oclif v4 with TypeScript and tsup for bundling. I want my main command to run by default, without requiring the user to type it as a subcommand.
Currently, my oclif ...
0
votes
1
answer
69
views
oclif runCommand vitest test fails with command X not found
I have a few commands with oclif whose tests fail with vitest but pass with jest. I believe something is off with the mocking. This is the structure:
src/
commands/
foo-cmd.ts
tests/
...
0
votes
0
answers
229
views
oclif generate command won't pass initial tests
I generated a new CLI with oclif, and everything was functional with the "hello, world" example provided. However, when I went to edit the initial "hello world" example I am no ...
1
vote
0
answers
474
views
How to add less/more command like pagination in a custom CLI?
I'm building a CLI with Node.js and want to add less/more like pagination.
I can just stdout the output and pipe it to less like this
but I'm not able to add the text highlight just like git log in ...
1
vote
0
answers
352
views
How can I create a single command cli with oclif?
I'm writing a CLI using oclif. I want to use it like mycli [flags]. But I could't found a method to create a silgle command CLI.
I have read oclif's docs, https://oclif.io/docs/flags; There's ...
1
vote
1
answer
208
views
How do I programatically read the version of a currently running oclif app?
This title says it all: How do I programatically read the version of a currently running oclif command-line app (from within the app)?
0
votes
1
answer
428
views
How to add same flag to multiple commands in Oclif framework?
I'm writing a CLI using Heroku's CLI framework oclif. It works great, but I have a flag that is applicable to only list type commands. How to add the same flag to multiple commands but not to all in ...
0
votes
1
answer
566
views
Oclif with yarn workspaces
I have a node / typescript application that leverages yarn workspaces. We are also using oclif for our cli.
I want to set up an architecutre where my main cli can leverge cli-plugins from the domains
...
1
vote
0
answers
134
views
terminal window in web page with OCLIF
I have an existing cli with OCLIF. I'd like to embed the cli in an angular web application. Is this possible? How might I start this? I started looking at xterm.js. Can these two technologies be ...
3
votes
0
answers
164
views
Oclif - How to use compiled JS instead of TS
I have a CMD project based on oclif framework written on TypeScript. I'm wondering - is it possible to compile .ts into .js for production use?
I tried to compile files into ./lib folder, then run a ...
2
votes
0
answers
162
views
OClif mock method
Let's say I have
export class MyCommand {
async run() {
this.someCommand();
...
}
someCommand() {
}
}
I want to write a test for the run command but mock out the someCommand. How ...
2
votes
0
answers
588
views
@oclif/test with `inquirer.prompt`
I am trying to test my entire cli dialogs using oclif and @oclif/test.
Prompts are made with inquirer.
Everything work fine, except the use of the .stdin( mock.
Feature extract looks like this:
...
...
1
vote
1
answer
784
views
How can I test oclif CLI that consumes Rest API
How can I test the following code build using Typescript in Oclif? This CLI consumes a rest api build with node.js and express.js. I am testing my api with mocha/chai which I have become familiar with....
0
votes
0
answers
187
views
How to insert multipart form data in mysql database? [duplicate]
I have created a Rest API with node js and express js. The Rest api is consumed by a cli I have created using oclif and typescript. I want to create a command that takes a csv file sends the data as ...
4
votes
1
answer
531
views
Oclif dynamic autocomplete with http call
Does Oclif support making a call to an API and getting the values returned in order to be used for autocomplete? I have the following use case:
Multiple users are stored in a database
When the user ...
3
votes
0
answers
844
views
How to use/build oclif (CLI node app) with nx?
I'm playing with a small app that fetch data from Jira, generates metrics and serves it to a React front-end (https://github.com/fgerthoffert/jira-agile-velocity).
It currently contains:
a CLI, built ...
1
vote
0
answers
949
views
Oclif cli released as a tarball: How to auto link the command to the bashRc without having to write "npm link"?
I am trying to release a cli built with oclif as a tarball. In the local env, I need to write npm link to link the code with the command. But in prod, I do not want the user to open a terminal and ...
2
votes
1
answer
1k
views
How test a user input using cli-ux prompt in oclif?
I am creating a cli app using oclif. The user executes a command, and the cli asks him if wants to continue (yes/no answer).
I trying to test the command that uses the cli-ux prompt. I want to ...
1
vote
1
answer
270
views
How to force --help command to execute in run method in Oclif
My requirement is quite simple. I want to execute help command when a user executes a specific command without enough arguments.
async run() {
if (!args.name) {
this.log(please provide a ...
11
votes
2
answers
23k
views
Cannot find Typescript module even though tsc successfully manages to resolve it
I have a Node.js project written in Typescript which is expected to run as a CLI, and am having trouble to import a module located out of the node_modules directory using an absolute path (relative ...