UNPKG

@shutootaki/gwm

Version:
33 lines 1.79 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useEffect, useState } from 'react'; import { Text, Box } from 'ink'; import { pullMainBranch, formatErrorForDisplay, } from '../utils/index.js'; export const WorktreePullMain = () => { const [results, setResults] = useState([]); const [error, setError] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { const executePull = async () => { try { setLoading(true); const pullResults = await pullMainBranch(); setResults(pullResults); } catch (err) { setError(formatErrorForDisplay(err)); } finally { setLoading(false); } }; executePull(); }, []); if (loading) { return (_jsx(Box, { children: _jsx(Text, { children: "Updating main branch worktrees..." }) })); } if (error) { return (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["\u274C Error: ", error] }) })); } return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "green", children: "\u2705 Finished updating main branches" }), _jsx(Text, {}), results.map((result, index) => (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: result.success ? 'green' : 'red', children: result.success ? '✅' : '❌' }), _jsxs(Text, { children: [" ", result.branch] }), _jsxs(Text, { color: "gray", children: [" (", result.path, ")"] })] }), result.message && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "gray", children: result.message }) }))] }, index)))] })); }; //# sourceMappingURL=WorktreePullMain.js.map