Skip to content

Commit eb14740

Browse files
committed
feat(cli): allow omitting 'dev' subcommand (Issue #12)
- vimd README.md -> vimd dev README.md - vimd . -> vimd dev . - Backward compatible: vimd dev <file> still works
1 parent ca64f98 commit eb14740

6 files changed

Lines changed: 50 additions & 9 deletions

File tree

CHANGELOG-en.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ All notable changes to this project will be documented in this file.
77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

10+
## [0.5.10] - 2026-01-28
11+
12+
### Added
13+
14+
- **CLI: `dev` subcommand can be omitted** (Issue #12)
15+
- `vimd README.md` now starts preview directly
16+
- `vimd .` now starts folder mode directly
17+
- Traditional `vimd dev <file>` form still works
18+
- More intuitive and concise command-line interface
19+
1020
## [0.5.9] - 2026-01-28
1121

1222
### Fixed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
フォーマットは [Keep a Changelog](https://keepachangelog.com/ja/1.0.0/) に基づいており、
88
このプロジェクトは [Semantic Versioning](https://semver.org/lang/ja/) に準拠しています。
99

10+
## [0.5.10] - 2026-01-28
11+
12+
### 追加
13+
14+
- **CLI: `dev` サブコマンドの省略機能** (Issue #12)
15+
- `vimd README.md` で直接プレビューを起動可能に
16+
- `vimd .` でフォルダモードを起動可能に
17+
- 従来の `vimd dev <file>` 形式も引き続き使用可能
18+
- より直感的で簡潔なコマンドラインインターフェース
19+
1020
## [0.5.9] - 2026-01-28
1121

1222
### 修正

README-en.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ choco install pandoc # Windows
8484

8585
```bash
8686
# Start live preview (no pandoc required, fast)
87-
vimd dev draft.md
87+
vimd draft.md # Shorthand (v0.5.10+)
88+
vimd dev draft.md # Traditional form also works
8889

8990
# Build static HTML (uses pandoc, high quality)
9091
vimd build draft.md
@@ -117,6 +118,8 @@ npm install -g vimd
117118

118119
| Command | Description |
119120
|---------|-------------|
121+
| `vimd <file>` | Start live preview server (`dev` shorthand) |
122+
| `vimd <folder>` | Start folder mode (`dev` shorthand) |
120123
| `vimd dev <file>` | Start live preview server |
121124
| `vimd dev <folder>` | Start folder mode |
122125
| `vimd build <file>` | Generate static HTML |
@@ -236,13 +239,15 @@ vimd can preview multiple files in a folder on the same port (v0.5.0+).
236239

237240
```bash
238241
# Preview current directory
239-
vimd dev .
242+
vimd . # Shorthand (v0.5.10+)
243+
vimd dev . # Traditional form also works
240244

241245
# Preview a specific folder
242-
vimd dev ./docs
246+
vimd ./docs # Shorthand
247+
vimd dev ./docs # Traditional form
243248
```
244249

245-
Select files from a VSCode-style sidebar and preview them in real-time.
250+
Select files from the sidebar and preview them in real-time.
246251

247252
**Supported extensions**:
248253
- `.md` (Markdown)

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ choco install pandoc # Windows
8484

8585
```bash
8686
# ライブプレビューを開始(pandoc不要、高速)
87-
vimd dev draft.md
87+
vimd draft.md # 省略形式(v0.5.10以降)
88+
vimd dev draft.md # 従来の形式も使用可能
8889

8990
# 静的HTMLを生成(pandoc使用、高品質)
9091
vimd build draft.md
@@ -117,6 +118,8 @@ npm install -g vimd
117118

118119
| コマンド | 説明 |
119120
| ------------------- | ------------------------------ |
121+
| `vimd <file>` | ライブプレビューサーバーを起動(`dev`省略形) |
122+
| `vimd <folder>` | フォルダモードを起動(`dev`省略形) |
120123
| `vimd dev <file>` | ライブプレビューサーバーを起動 |
121124
| `vimd dev <folder>` | フォルダモードを起動 |
122125
| `vimd build <file>` | 静的HTMLを生成 |
@@ -236,13 +239,15 @@ vimd はフォルダ内の複数ファイルを同一ポートで切り替えな
236239

237240
```bash
238241
# カレントディレクトリをプレビュー
239-
vimd dev .
242+
vimd . # 省略形式(v0.5.10以降)
243+
vimd dev . # 従来の形式も使用可能
240244

241245
# 指定フォルダをプレビュー
242-
vimd dev ./docs
246+
vimd ./docs # 省略形式
247+
vimd dev ./docs # 従来の形式
243248
```
244249

245-
VSCode風のサイドバーでファイルを選択し、リアルタイムでプレビューを確認できます。
250+
サイドバーでファイルを選択し、リアルタイムでプレビューを確認できます。
246251

247252
**対応する拡張子**:
248253
- `.md` (Markdown)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vimd",
3-
"version": "0.5.9",
3+
"version": "0.5.10",
44
"description": "Real-time Markdown preview tool with pandoc (view markdown)",
55
"type": "module",
66
"keywords": [

src/cli/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,15 @@ program
6666
.option('-y, --yes', 'Skip confirmation prompt')
6767
.action(resetCommand);
6868

69+
// Allow omitting 'dev' subcommand: vimd README.md -> vimd dev README.md
70+
const subcommands = ['dev', 'build', 'theme', 'config', 'kill', 'reset', 'help'];
71+
const globalFlags = ['--help', '-h', '--version', '-V'];
72+
const args = process.argv.slice(2);
73+
const firstArg = args[0];
74+
75+
// Insert 'dev' if first argument is not a subcommand or global flag
76+
if (firstArg && !subcommands.includes(firstArg) && !globalFlags.includes(firstArg)) {
77+
process.argv.splice(2, 0, 'dev');
78+
}
79+
6980
program.parse(process.argv);

0 commit comments

Comments
 (0)