Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ updates:
schedule:
interval: weekly
day: monday
ignore:
- dependency-name: "ink"
open-pull-requests-limit: 10
cooldown:
semver-major-days: 30
Expand Down
162 changes: 83 additions & 79 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"eslint-plugin-import-newlines": "^1.4.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
"ink": "^6.2.0",
"ink": "6.2.0",
"ink-gradient": "^3.0.0",
"ink-select-input": "^6.2.0",
"pluralize": "^8.0.0",
Expand Down
98 changes: 49 additions & 49 deletions src/tui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,56 +208,56 @@ export const App: React.FC = () => {

const handleMainMenuSelect = async (value: string) => {
switch (value) {
case 'lines':
setScreen('lines');
break;
case 'colors':
setScreen('colorLines');
break;
case 'terminalConfig':
setScreen('terminalConfig');
break;
case 'globalOverrides':
setScreen('globalOverrides');
break;
case 'powerline':
setScreen('powerline');
break;
case 'install':
handleInstallUninstall();
break;
case 'starGithub':
setConfirmDialog({
message: `Open the ccstatusline GitHub repository in your browser?\n\n${GITHUB_REPO_URL}`,
action: () => {
const result = openExternalUrl(GITHUB_REPO_URL);
if (result.success) {
setFlashMessage({
text: '✓ Opened GitHub repository in browser',
color: 'green'
});
} else {
setFlashMessage({
text: `✗ Could not open browser. Visit: ${GITHUB_REPO_URL}`,
color: 'red'
});
case 'lines':
setScreen('lines');
break;
case 'colors':
setScreen('colorLines');
break;
case 'terminalConfig':
setScreen('terminalConfig');
break;
case 'globalOverrides':
setScreen('globalOverrides');
break;
case 'powerline':
setScreen('powerline');
break;
case 'install':
handleInstallUninstall();
break;
case 'starGithub':
setConfirmDialog({
message: `Open the ccstatusline GitHub repository in your browser?\n\n${GITHUB_REPO_URL}`,
action: () => {
const result = openExternalUrl(GITHUB_REPO_URL);
if (result.success) {
setFlashMessage({
text: '✓ Opened GitHub repository in browser',
color: 'green'
});
} else {
setFlashMessage({
text: `✗ Could not open browser. Visit: ${GITHUB_REPO_URL}`,
color: 'red'
});
}
setScreen('main');
setConfirmDialog(null);
return Promise.resolve();
}
setScreen('main');
setConfirmDialog(null);
return Promise.resolve();
}
});
setScreen('confirm');
break;
case 'save':
await saveSettings(settings);
setOriginalSettings(cloneSettings(settings)); // Update original after save
setHasChanges(false);
exit();
break;
case 'exit':
exit();
break;
});
setScreen('confirm');
break;
case 'save':
await saveSettings(settings);
setOriginalSettings(cloneSettings(settings)); // Update original after save
setHasChanges(false);
exit();
break;
case 'exit':
exit();
break;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/tui/components/ItemsEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const ItemsEditor: React.FC<ItemsEditorProps> = ({ widgets, onUpdate, onB
? widgetPicker.selectedCategory
: (pickerCategories[0] ?? null))
: null;
const topLevelSearchEntries = widgetPicker && widgetPicker.level === 'category' && widgetPicker.categoryQuery.trim().length > 0
const topLevelSearchEntries = widgetPicker?.level === 'category' && widgetPicker.categoryQuery.trim().length > 0
? filterWidgetCatalog(widgetCatalog, 'All', widgetPicker.categoryQuery)
: [];
const selectedTopLevelSearchEntry = widgetPicker
Expand Down
30 changes: 15 additions & 15 deletions src/tui/components/LineSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,21 @@ const LineSelector: React.FC<LineSelectorProps> = ({
}

switch (input) {
case 'a':
if (allowEditing) {
appendLine();
}
return;
case 'd':
if (allowEditing && localLines.length > 1) {
setShowDeleteDialog(true);
}
return;
case 'm':
if (allowEditing && localLines.length > 1 && selectedIndex < localLines.length) {
setMoveMode(true);
}
return;
case 'a':
if (allowEditing) {
appendLine();
}
return;
case 'd':
if (allowEditing && localLines.length > 1) {
setShowDeleteDialog(true);
}
return;
case 'm':
if (allowEditing && localLines.length > 1 && selectedIndex < localLines.length) {
setMoveMode(true);
}
return;
}

if (key.escape) {
Expand Down
44 changes: 22 additions & 22 deletions src/tui/components/PowerlineSeparatorEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export const PowerlineSeparatorEditor: React.FC<PowerlineSeparatorEditorProps> =
// Get the appropriate array based on mode
const getItems = () => {
switch (mode) {
case 'separator':
return powerlineConfig.separators;
case 'startCap':
return powerlineConfig.startCaps;
case 'endCap':
return powerlineConfig.endCaps;
case 'separator':
return powerlineConfig.separators;
case 'startCap':
return powerlineConfig.startCaps;
case 'endCap':
return powerlineConfig.endCaps;
}
};

Expand Down Expand Up @@ -92,16 +92,16 @@ export const PowerlineSeparatorEditor: React.FC<PowerlineSeparatorEditorProps> =
const updatedPowerline = { ...powerlineConfig };

switch (mode) {
case 'separator':
updatedPowerline.separators = newSeparators;
updatedPowerline.separatorInvertBackground = newInvertBgs ?? newSeparators.map((_, i) => invertBgs[i] ?? false);
break;
case 'startCap':
updatedPowerline.startCaps = newSeparators;
break;
case 'endCap':
updatedPowerline.endCaps = newSeparators;
break;
case 'separator':
updatedPowerline.separators = newSeparators;
updatedPowerline.separatorInvertBackground = newInvertBgs ?? newSeparators.map((_, i) => invertBgs[i] ?? false);
break;
case 'startCap':
updatedPowerline.startCaps = newSeparators;
break;
case 'endCap':
updatedPowerline.endCaps = newSeparators;
break;
}

onUpdate({
Expand Down Expand Up @@ -261,12 +261,12 @@ export const PowerlineSeparatorEditor: React.FC<PowerlineSeparatorEditorProps> =

const getTitle = () => {
switch (mode) {
case 'separator':
return 'Powerline Separator Configuration';
case 'startCap':
return 'Powerline Start Cap Configuration';
case 'endCap':
return 'Powerline End Cap Configuration';
case 'separator':
return 'Powerline Separator Configuration';
case 'startCap':
return 'Powerline Start Cap Configuration';
case 'endCap':
return 'Powerline End Cap Configuration';
}
};

Expand Down
30 changes: 15 additions & 15 deletions src/tui/components/PowerlineSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,21 +382,21 @@ export const PowerlineSetup: React.FC<PowerlineSetupProps> = ({
let displayValue = '';

switch (item.value) {
case 'separator':
displayValue = getSeparatorDisplay();
break;
case 'startCap':
displayValue = getCapDisplay('start');
break;
case 'endCap':
displayValue = getCapDisplay('end');
break;
case 'themes':
displayValue = getThemeDisplay();
break;
case 'back':
displayValue = '';
break;
case 'separator':
displayValue = getSeparatorDisplay();
break;
case 'startCap':
displayValue = getCapDisplay('start');
break;
case 'endCap':
displayValue = getCapDisplay('end');
break;
case 'themes':
displayValue = getThemeDisplay();
break;
case 'back':
displayValue = '';
break;
}

if (item.value === 'back') {
Expand Down
12 changes: 6 additions & 6 deletions src/tui/components/TerminalOptionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ export const TerminalOptionsMenu: React.FC<TerminalOptionsMenuProps> = ({ settin

export const getColorLevelLabel = (level?: 0 | 1 | 2 | 3): string => {
switch (level) {
case 0: return 'No Color';
case 1: return 'Basic';
case 2:
case undefined: return '256 Color (default)';
case 3: return 'Truecolor';
default: return '256 Color (default)';
case 0: return 'No Color';
case 1: return 'Basic';
case 2:
case undefined: return '256 Color (default)';
case 3: return 'Truecolor';
default: return '256 Color (default)';
}
};
2 changes: 1 addition & 1 deletion src/tui/components/items-editor/input-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export function handleNormalInputMode({
}
} else if (input === ' ' && widgets.length > 0) {
const currentWidget = widgets[selectedIndex];
if (currentWidget && currentWidget.type === 'separator') {
if (currentWidget?.type === 'separator') {
const currentChar = currentWidget.character ?? '|';
const currentCharIndex = separatorChars.indexOf(currentChar);
const nextChar = separatorChars[(currentCharIndex + 1) % separatorChars.length];
Expand Down
16 changes: 8 additions & 8 deletions src/types/ColorLevel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export type ColorLevelString = 'ansi16' | 'ansi256' | 'truecolor';
// Helper to get color level as string for chalk
export function getColorLevelString(level: ColorLevel | undefined): ColorLevelString {
switch (level) {
case 0:
case 1:
return 'ansi16';
case 3:
return 'truecolor';
case 2:
default:
return 'ansi256';
case 0:
case 1:
return 'ansi16';
case 3:
return 'truecolor';
case 2:
default:
return 'ansi256';
}
}
32 changes: 16 additions & 16 deletions src/utils/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ export function getChalkColor(colorName: string | undefined, colorLevel: 'ansi16
}

switch (colorLevel) {
case 'ansi256':
return colorEntry.ansi256;
case 'truecolor':
return colorEntry.truecolor;
case 'ansi16':
default:
return colorEntry.ansi16;
case 'ansi256':
return colorEntry.ansi256;
case 'truecolor':
return colorEntry.truecolor;
case 'ansi16':
default:
return colorEntry.ansi16;
}
}

Expand Down Expand Up @@ -198,15 +198,15 @@ export function getColorAnsiCode(colorName: string | undefined, colorLevel: 'ans
// Now that chalk.level is set correctly, we can use chalk to generate the codes
let chalkFn: ChalkInstance;
switch (colorLevel) {
case 'ansi256':
chalkFn = colorEntry.ansi256;
break;
case 'truecolor':
chalkFn = colorEntry.truecolor;
break;
default:
chalkFn = colorEntry.ansi16;
break;
case 'ansi256':
chalkFn = colorEntry.ansi256;
break;
case 'truecolor':
chalkFn = colorEntry.truecolor;
break;
default:
chalkFn = colorEntry.ansi16;
break;
}

// Apply the color and extract the opening ANSI code
Expand Down
8 changes: 4 additions & 4 deletions src/utils/usage-windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ export function formatUsageDuration(durationMs: number): string {

export function getUsageErrorMessage(error: UsageError): string {
switch (error) {
case 'no-credentials': return '[No credentials]';
case 'timeout': return '[Timeout]';
case 'api-error': return '[API Error]';
case 'parse-error': return '[Parse Error]';
case 'no-credentials': return '[No credentials]';
case 'timeout': return '[Timeout]';
case 'api-error': return '[API Error]';
case 'parse-error': return '[Parse Error]';
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/widgets/CustomCommand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ interface EditorMode { type: 'command' | 'width' | 'timeout' | null }
const CustomCommandEditor: React.FC<WidgetEditorProps> = ({ widget, onComplete, onCancel, action }) => {
const getMode = (): EditorMode['type'] => {
switch (action) {
case 'edit-command': return 'command';
case 'edit-width': return 'width';
case 'edit-timeout': return 'timeout';
default: return 'command';
case 'edit-command': return 'command';
case 'edit-width': return 'width';
case 'edit-timeout': return 'timeout';
default: return 'command';
}
};
const mode = getMode();
Expand Down
Loading