@falldownthesystem/devtool 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.js CHANGED
@@ -1,42 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { createRequire } from 'node:module';
3
4
  import { Command } from 'commander';
4
- import { isConfigured, runSetup } from './config/store.js';
5
5
  import configCmd from './commands/config.js';
6
6
  import prCmd from './commands/pr.js';
7
7
  import jiraCmd from './commands/jira.js';
8
8
  import confluenceCmd from './commands/confluence.js';
9
9
  import sdCmd from './commands/sd.js';
10
+ import graphCmd from './commands/graph.js';
11
+
12
+ const { version } = createRequire(import.meta.url)('../package.json');
10
13
 
11
14
  const program = new Command();
12
15
 
13
16
  program
14
17
  .name('dev')
15
- .description('CLI for Bitbucket PRs, Jira tickets, Confluence pages, and Service Desk tickets')
16
- .version('0.4.1')
18
+ .description('CLI for Bitbucket, Jira, Confluence, Service Desk, and Microsoft Graph')
19
+ .version(version)
17
20
  .option('--json', 'Output raw JSON')
18
- .option('--plain', 'Output compact plain text (no tables, no colors)');
21
+ .option('--plain', 'Output compact plain text (no tables, no colors)')
22
+ .option('-c, --connection <name>', 'Connection to use (defaults to the default connection of the command\'s type)');
19
23
 
20
24
  program.addCommand(configCmd);
21
25
  program.addCommand(prCmd);
22
26
  program.addCommand(jiraCmd);
23
27
  program.addCommand(confluenceCmd);
24
28
  program.addCommand(sdCmd);
25
-
26
- program.hook('preAction', async (thisCommand, actionCommand) => {
27
- const cmdChain = [];
28
- let cmd = actionCommand;
29
- while (cmd) {
30
- cmdChain.unshift(cmd.name());
31
- cmd = cmd.parent;
32
- }
33
- if (cmdChain.includes('config')) return;
34
-
35
- if (!isConfigured()) {
36
- console.log('First run detected. Let\'s set up your configuration.\n');
37
- await runSetup();
38
- console.log('');
39
- }
40
- });
29
+ program.addCommand(graphCmd);
41
30
 
42
31
  program.parse();
@@ -0,0 +1,5 @@
1
+ import { getConnection } from '../config/store.js';
2
+
3
+ export function connectionFor(cmd, type) {
4
+ return getConnection(type, cmd.optsWithGlobals().connection);
5
+ }