Skip to content

Commit 0ab93a7

Browse files
committed
refactor(subtree): reorganize commands and update imports
1 parent 59493f2 commit 0ab93a7

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

tools/monoblok/src/commands/add.ts renamed to tools/monoblok/src/commands/subtree/add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Command } from 'commander';
22
import chalk from 'chalk';
3-
import * as utils from '../utils';
3+
import * as utils from '../../utils';
44
import fs from 'node:fs';
55

66
export function addCommand(program: Command): void {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Command } from 'commander';
2+
import { addCommand } from './add';
3+
import { pullCommand } from './pull';
4+
import { rebuildCommand } from './rebuild';
5+
6+
export function subtreeCommand(program: Command): void {
7+
const subtree = program
8+
.command('subtree')
9+
.description('Manage git subtrees for monorepo packages');
10+
11+
// Add subtree-related subcommands
12+
addCommand(subtree);
13+
pullCommand(subtree);
14+
rebuildCommand(subtree);
15+
}

tools/monoblok/src/commands/pull.ts renamed to tools/monoblok/src/commands/subtree/pull.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Command } from 'commander';
22
import chalk from 'chalk';
3-
import * as utils from '../utils';
3+
import * as utils from '../../utils';
44

55
export function pullCommand(program: Command): void {
66
program

tools/monoblok/src/commands/rebuild.ts renamed to tools/monoblok/src/commands/subtree/rebuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import chalk from 'chalk';
33
import fs from 'fs';
44
import path from 'path';
55
import inquirer from 'inquirer';
6-
import * as utils from '../utils';
6+
import * as utils from '../../utils';
77

88
export function rebuildCommand(program: Command): void {
99
program

tools/monoblok/src/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
import { Command } from 'commander';
2-
import { addCommand } from './commands/add';
3-
import { pullCommand } from './commands/pull';
4-
import { rebuildCommand } from './commands/rebuild';
5-
6-
2+
import { subtreeCommand } from './commands/subtree';
73

84
// Create the program
95
const program = new Command();
106

117
// Set up CLI metadata
128
program
139
.name('monoblok')
14-
.description('CLI tool for managing subtrees in the monoblok monorepo')
10+
.description('CLI tool for managing the monoblok monorepo')
1511
.version('0.1.0');
1612

1713
// Register commands
18-
addCommand(program);
19-
pullCommand(program);
20-
rebuildCommand(program);
14+
subtreeCommand(program);
2115

2216
// Parse command line arguments
2317
program.parse();

0 commit comments

Comments
 (0)