vimd 0.2.2 → 0.2.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.
package/README.md
CHANGED
|
@@ -108,6 +108,7 @@ vimd config
|
|
|
108
108
|
| `vimd theme` | テーマを対話的に変更 |
|
|
109
109
|
| `vimd config` | 設定を対話的に編集 |
|
|
110
110
|
| `vimd kill` | 実行中のセッションを終了 |
|
|
111
|
+
| `vimd reset` | 設定をデフォルトにリセット |
|
|
111
112
|
|
|
112
113
|
### オプション
|
|
113
114
|
|
|
@@ -126,6 +127,10 @@ vimd build draft.md --theme dark # テーマ指定
|
|
|
126
127
|
# kill コマンド
|
|
127
128
|
vimd kill # 全セッションを終了
|
|
128
129
|
vimd kill --port 38080 # 特定ポートのセッションを終了
|
|
130
|
+
|
|
131
|
+
# reset コマンド
|
|
132
|
+
vimd reset # 設定をリセット(確認あり)
|
|
133
|
+
vimd reset --yes # 確認なしでリセット
|
|
129
134
|
```
|
|
130
135
|
|
|
131
136
|
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/reset.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCvE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/cli/commands/reset.ts
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { PathResolver } from '../../utils/path-resolver.js';
|
|
6
|
+
import { DEFAULT_CONFIG } from '../../config/defaults.js';
|
|
7
|
+
export async function resetCommand(options) {
|
|
8
|
+
try {
|
|
9
|
+
const configPath = PathResolver.getConfigPath();
|
|
10
|
+
// Check if config file exists
|
|
11
|
+
if (!(await fs.pathExists(configPath))) {
|
|
12
|
+
Logger.info('No configuration file found. Already using default settings.');
|
|
13
|
+
Logger.info(` Default port: ${DEFAULT_CONFIG.port}`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// Confirm deletion unless --yes is specified
|
|
17
|
+
if (!options.yes) {
|
|
18
|
+
const { confirmed } = await inquirer.prompt([
|
|
19
|
+
{
|
|
20
|
+
type: 'confirm',
|
|
21
|
+
name: 'confirmed',
|
|
22
|
+
message: 'Are you sure you want to reset the configuration?',
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
if (!confirmed) {
|
|
27
|
+
Logger.info('Configuration reset cancelled');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Delete the config file
|
|
32
|
+
await fs.remove(configPath);
|
|
33
|
+
Logger.success('Configuration reset. Default settings will be used on next run.');
|
|
34
|
+
Logger.info(` Default port: ${DEFAULT_CONFIG.port}`);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38
|
+
Logger.error(`Failed to reset configuration: ${errorMessage}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { buildCommand } from './commands/build.js';
|
|
|
6
6
|
import { themeCommand } from './commands/theme.js';
|
|
7
7
|
import { configCommand } from './commands/config.js';
|
|
8
8
|
import { killCommand } from './commands/kill.js';
|
|
9
|
+
import { resetCommand } from './commands/reset.js';
|
|
9
10
|
const require = createRequire(import.meta.url);
|
|
10
11
|
const packageJson = require('../../package.json');
|
|
11
12
|
const program = new Command();
|
|
@@ -48,4 +49,10 @@ program
|
|
|
48
49
|
.option('--all', 'Kill all sessions (default)')
|
|
49
50
|
.option('--port <port>', 'Kill session on specific port')
|
|
50
51
|
.action(killCommand);
|
|
52
|
+
// vimd reset
|
|
53
|
+
program
|
|
54
|
+
.command('reset')
|
|
55
|
+
.description('Reset configuration to defaults')
|
|
56
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
57
|
+
.action(resetCommand);
|
|
51
58
|
program.parse(process.argv);
|