@shutootaki/gwm
Version:
git worktree manager CLI
33 lines • 9.61 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Text, Box } from 'ink';
const GlobalHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "gwm: A CLI tool to streamline your git worktree workflow." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm <command> [arguments] [options]" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "AVAILABLE COMMANDS:" }), _jsx(Text, { children: " add Create a new worktree" }), _jsx(Text, { children: " go Go to a worktree directory or open it in an editor" }), _jsx(Text, { children: " list (ls) List all worktrees for the current project" }), _jsx(Text, { children: " pull-main Update the main branch worktree" }), _jsx(Text, { children: " remove (rm) Remove one or more worktrees" }), _jsx(Text, { children: " clean Clean up safe-to-delete worktrees" }), _jsx(Text, { children: " help Show help for gwm or a specific command" }), _jsx(Text, {}), _jsx(Text, { children: "Use \"gwm help <command>\" for more information about a specific command." })] }));
const AddHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Create a new worktree from a new, existing, or remote branch." }), _jsx(Text, { children: "If no branch name is provided, an interactive UI will be launched." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm add [branch_name] [options]" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "ARGUMENTS:" }), _jsxs(Text, { children: [' ', "branch_name Name of the branch for the new worktree. (optional)"] }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "OPTIONS:" }), _jsxs(Text, { children: [' ', "-r, --remote Fetch from remote and create a worktree from a remote branch"] }), _jsxs(Text, { children: [' ', "--from <base_branch> Specify the base branch to branch off from."] }), _jsxs(Text, { children: [' ', "Defaults to the first branch in 'main_branches' config (e.g., \"main\")."] }), _jsx(Text, { children: " --code Open the new worktree in VS Code after creation" }), _jsx(Text, { children: " --cursor Open the new worktree in Cursor after creation" }), _jsxs(Text, { children: [' ', "--cd Output the path to the new worktree (for shell integration)"] }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # Interactively create a new branch and worktree" }), _jsx(Text, { children: " $ gwm add" }), _jsx(Text, {}), _jsxs(Text, { children: [' ', "# Create a worktree for a new branch 'feature/user-profile' from the main branch"] }), _jsx(Text, { children: " $ gwm add feature/user-profile" }), _jsx(Text, {}), _jsxs(Text, { children: [' ', "# Create a worktree from a remote branch for a pull request review"] }), _jsx(Text, { children: " $ gwm add a-pull-request-branch -r" }), _jsx(Text, {}), _jsxs(Text, { children: [' ', "# Create a new branch from 'develop' instead of the default main branch"] }), _jsx(Text, { children: " $ gwm add hotfix/urgent-patch --from develop" })] }));
const ListHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "List all worktrees for the current project with their status indicators." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm list" }), _jsx(Text, { children: " gwm ls" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "STATUS INDICATORS:" }), _jsx(Text, { children: " * ACTIVE - Current worktree (yellow)" }), _jsx(Text, { children: " M MAIN - Base main worktree (cyan)" }), _jsx(Text, { children: " - OTHER - All other worktrees (white)" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # List all worktrees" }), _jsx(Text, { children: " $ gwm list" }), _jsx(Text, { children: " $ gwm ls" })] }));
const RemoveHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Remove one or more worktrees with search selection." }), _jsx(Text, { children: "If no query is provided, an interactive UI will be launched." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm remove [query] [options]" }), _jsx(Text, { children: " gwm rm [query] [options]" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "ARGUMENTS:" }), _jsx(Text, { children: " query Search query to filter worktrees (optional)" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "OPTIONS:" }), _jsx(Text, { children: " -f, --force Force remove worktree without confirmation" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # Interactively select worktrees to remove" }), _jsx(Text, { children: " $ gwm remove" }), _jsx(Text, {}), _jsx(Text, { children: " # Remove worktrees matching 'feature'" }), _jsx(Text, { children: " $ gwm remove feature" }), _jsx(Text, {}), _jsx(Text, { children: " # Force remove without confirmation" }), _jsx(Text, { children: " $ gwm remove old-branch --force" })] }));
const GoHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Go to a worktree directory or open it in an editor." }), _jsx(Text, { children: "If no query is provided, an interactive UI will be launched." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm go [query] [options]" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "ARGUMENTS:" }), _jsx(Text, { children: " query Search query to filter worktrees (optional)" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "OPTIONS:" }), _jsx(Text, { children: " -c, --code Open selected worktree in VS Code" }), _jsx(Text, { children: " --cursor Open selected worktree in Cursor" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # Interactively select a worktree to navigate to" }), _jsx(Text, { children: " $ gwm go" }), _jsx(Text, {}), _jsx(Text, { children: " # Navigate to worktree matching 'feature'" }), _jsx(Text, { children: " $ gwm go feature" }), _jsx(Text, {}), _jsx(Text, { children: " # Open worktree in VS Code" }), _jsx(Text, { children: " $ gwm go main --code" }), _jsx(Text, {}), _jsx(Text, { color: "gray", children: "Note: Use with shell function wgo() for directory navigation" })] }));
const PullMainHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Update the main branch worktree to the latest state." }), _jsx(Text, { children: "This command pulls the latest changes in all main branch worktrees." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm pull-main" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # Update main branch worktrees" }), _jsx(Text, { children: " $ gwm pull-main" })] }));
const HelpHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Show help information for gwm or a specific command." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm help [command]" }), _jsx(Text, { children: " gwm --help" }), _jsx(Text, { children: " gwm -h" }), _jsx(Text, { children: " gwm <command> --help" }), _jsx(Text, { children: " gwm <command> -h" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "ARGUMENTS:" }), _jsx(Text, { children: " command Show help for a specific command (optional)" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # Show general help" }), _jsx(Text, { children: " $ gwm help" }), _jsx(Text, {}), _jsx(Text, { children: " # Show help for the add command" }), _jsx(Text, { children: " $ gwm help add" }), _jsx(Text, { children: " $ gwm add --help" })] }));
const CleanHelp = () => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Detect and remove worktrees that are safe to delete." }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "USAGE:" }), _jsx(Text, { children: " gwm clean [-n] [--force]" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "OPTIONS:" }), _jsx(Text, { children: " -n, --dry-run Show candidates only, do not delete" }), _jsx(Text, { children: " --force Skip confirmation and delete immediately" }), _jsx(Text, {}), _jsx(Text, { bold: true, children: "EXAMPLES:" }), _jsx(Text, { children: " # Preview cleanable worktrees" }), _jsx(Text, { children: " $ gwm clean -n" }), _jsx(Text, {}), _jsx(Text, { children: " # Force clean without confirmation (CI etc.)" }), _jsx(Text, { children: " $ gwm clean --force" })] }));
const UnknownCommandHelp = ({ command }) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "red", children: ["Unknown command: ", command] }), _jsx(Text, {}), _jsx(Text, { children: "Available commands: add, list (ls), remove (rm), clean, go, pull-main, help" }), _jsx(Text, {}), _jsx(Text, { children: "Use \"gwm help\" to see all available commands." })] }));
const commandHelpComponents = {
add: AddHelp,
list: ListHelp,
ls: ListHelp,
remove: RemoveHelp,
rm: RemoveHelp,
clean: CleanHelp,
go: GoHelp,
'pull-main': PullMainHelp,
help: HelpHelp,
};
export const Help = ({ command }) => {
if (!command) {
return _jsx(GlobalHelp, {});
}
const CommandHelpComponent = commandHelpComponents[command];
if (CommandHelpComponent) {
return _jsx(CommandHelpComponent, {});
}
return _jsx(UnknownCommandHelp, { command: command });
};
//# sourceMappingURL=Help.js.map