import {TypeTag} from '@extollo/lib'

export type ShellCommand = TypeTag<'p5x.shell-command'> & string

export const shellCommand = (...parts: string[]): ShellCommand => parts.join(' ') as ShellCommand

export interface CommandPaletteCommands {
    tempPath: ShellCommand
    tempFile: ShellCommand
    cpuPercentage: ShellCommand
    ramPercentage: ShellCommand
    mountPointPercentage: ShellCommand
    listMountPoints: ShellCommand
    fileDirectoryDelete: ShellCommand
    resolvePath: ShellCommand
    reboot: ShellCommand
    changeDirectory: ShellCommand
    fileDirectoryPermissionFetch: ShellCommand
    fileDirectoryPermissionSetFlat: ShellCommand
    fileDirectoryPermissionSetRecursive: ShellCommand
    fileDirectoryOwnershipFetch: ShellCommand
    fileDirectoryOwnershipSetFlat: ShellCommand
    fileDirectoryOwnershipSetRecursive: ShellCommand
    echo: ShellCommand
}

export type CommandPalette = CommandPaletteCommands & {
    format(command: keyof CommandPaletteCommands, substitutions: Record<string, any>): ShellCommand
}

export interface OwnershipSpec {
    user: string
    group: string
}
