Skip to content

Commit

Permalink
docs: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Feb 2, 2024
1 parent cda11df commit 91be142
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions examples/tabtab-test-complete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ const tabtab = require('../..');
const args = opts._;

const completion = env => {
const shell = tabtab.getShellFromEnv(env);

if (!env.complete) return;

if (env.prev === 'someCommand') {
return tabtab.log(['is', 'this', 'the', 'real', 'life']);
return tabtab.log(['is', 'this', 'the', 'real', 'life'], shell);
}

if (env.prev === 'anotherOne') {
return tabtab.log(['is', 'this', 'just', 'fantasy']);
return tabtab.log(['is', 'this', 'just', 'fantasy'], shell);
}

if (env.prev === '--loglevel') {
return tabtab.log(['error', 'warn', 'info', 'notice', 'verbose']);
return tabtab.log(['error', 'warn', 'info', 'notice', 'verbose'], shell);
}

return tabtab.log([
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const opts = require('minimist')(process.argv.slice(2), {

const args = opts._;
const completion = env => {
const shell = tabtab.getShellFromEnv(env);

if (!env.complete) return;

// Write your completions there
Expand Down Expand Up @@ -91,7 +93,7 @@ const completion = env => {
description: 'You must add a description for items with ":" in them'
},
'anotherOne'
]);
], shell);
};

const run = async () => {
Expand Down

0 comments on commit 91be142

Please sign in to comment.