This commit is contained in:
Chris Wanstrath 2026-01-29 23:39:28 -08:00
parent aa5b536942
commit 07300eb96f
2 changed files with 25 additions and 7 deletions

View File

@ -276,18 +276,20 @@ async function getApp(name: string) {
console.log(color.green(`✓ Downloaded ${name}`))
}
function isApp(): boolean {
function getAppPackage(): { name?: string; scripts?: { toes?: string } } | null {
try {
const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8'))
return !!pkg?.scripts?.toes
} catch (e) {
return false
return JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8'))
} catch {
return null
}
}
const isApp = () => !!getAppPackage()?.scripts?.toes
function resolveAppName(name?: string): string | undefined {
if (name) return name
if (isApp()) return basename(process.cwd())
const pkg = getAppPackage()
if (pkg?.scripts?.toes) return pkg.name || basename(process.cwd())
console.error('No app specified and current directory is not a toes app')
return undefined
}
@ -648,6 +650,22 @@ async function rmApp(arg?: string) {
program
.name('toes')
.version('0.0.1', '-v, --version')
.addHelpText('beforeAll', (ctx) => {
if (ctx.command === program) {
return color.bold().cyan('\n🐾 Toes') + color.gray(' - personal web appliance\n')
}
return ''
})
.configureOutput({
writeOut: (str) => {
const colored = str
.replace(/^(Usage:)/gm, color.yellow('$1'))
.replace(/^(Commands:)/gm, color.yellow('$1'))
.replace(/^(Options:)/gm, color.yellow('$1'))
.replace(/^(Arguments:)/gm, color.yellow('$1'))
process.stdout.write(colored)
},
})
program
.command('info')

View File

@ -605,7 +605,7 @@ const AppDetail = ({ app }: { app: App }) => (
{app.name}
</MainTitle>
<HeaderActions>
<Button>Settings</Button>
{/* <Button>Settings</Button> */}
<Button variant="danger" onClick={() => openDeleteAppModal(app)}>Delete</Button>
</HeaderActions>
</MainHeader>