@lsst/pik 0.6.2 → 0.6.3

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.
@@ -1,3 +1,3 @@
1
- import type { PikPlugin } from '@lsst/pik-core';
1
+ import { type PikPlugin } from '@lsst/pik-core';
2
2
  export declare const killportPlugin: PikPlugin;
3
3
  //# sourceMappingURL=killport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"killport.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/killport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAyEhD,eAAO,MAAM,cAAc,EAAE,SAgD5B,CAAC"}
1
+ {"version":3,"file":"killport.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/killport.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA6E5D,eAAO,MAAM,cAAc,EAAE,SAgE5B,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { execSync } from 'child_process';
2
2
  import { confirm, input } from '@inquirer/prompts';
3
3
  import pc from 'picocolors';
4
+ import { loadConfig } from '@lsst/pik-core';
4
5
  function getProcessesOnPort(port) {
5
6
  try {
6
7
  const output = execSync(`lsof -ti:${port}`, { encoding: 'utf-8' });
@@ -74,7 +75,21 @@ export const killportPlugin = {
74
75
  .description('Kill process running on a specific port')
75
76
  .argument('[port]', 'Port number (interactive if not provided)')
76
77
  .option('-y, --yes', 'Skip confirmation')
78
+ .option('--config', 'Output plugin config as JSON')
79
+ .option('--json', 'Use JSON output format')
77
80
  .action(async (portArg, options) => {
81
+ const pikConfig = await loadConfig();
82
+ const killportConfig = pikConfig?.killport || {};
83
+ const defaultPort = killportConfig.defaultPort;
84
+ if (options.config) {
85
+ if (options.json) {
86
+ console.log(JSON.stringify(killportConfig));
87
+ }
88
+ else {
89
+ console.log('defaultPort:', defaultPort ?? 'not set');
90
+ }
91
+ return;
92
+ }
78
93
  if (portArg) {
79
94
  const port = parseInt(portArg, 10);
80
95
  if (isNaN(port) || port < 1 || port > 65535) {
@@ -84,10 +99,11 @@ export const killportPlugin = {
84
99
  await killPortInteractive(port, options.yes ?? false);
85
100
  }
86
101
  else {
87
- // Interactive mode - prompt for port number
102
+ // Interactive mode - prompt for port number with default
88
103
  try {
89
104
  const portInput = await input({
90
105
  message: 'Port number:',
106
+ default: defaultPort?.toString(),
91
107
  validate: (value) => {
92
108
  const num = parseInt(value, 10);
93
109
  if (isNaN(num) || num < 1 || num > 65535) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsst/pik",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "CLI tool for switching config options in source files",
5
5
  "type": "module",
6
6
  "license": "MIT",