refactor
This commit is contained in:
parent
e8704dfcaf
commit
b10c132857
4 changed files with 141 additions and 138 deletions
5
index.ts
5
index.ts
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { timerToSeconds } from './src/helpers/math';
|
||||||
import previewList from './src/preview/cli-list'
|
import previewList from './src/preview/cli-list'
|
||||||
import previewSnippet from './src/preview/cli-snippet'
|
import previewSnippet from './src/preview/cli-snippet'
|
||||||
import buildTOML from './src/build/toml'
|
import buildTOML from './src/build/toml'
|
||||||
import { nanoseconds } from 'bun';
|
import buildKitty from './ports/kitty/src/build'
|
||||||
import { timerToSeconds } from './src/helpers/math';
|
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ program
|
||||||
log(options.verbose, await buildTOML(), timer)
|
log(options.verbose, await buildTOML(), timer)
|
||||||
|
|
||||||
if (options.verbose) console.info('Building Ports...')
|
if (options.verbose) console.info('Building Ports...')
|
||||||
|
log(options.verbose, await buildKitty(), timer)
|
||||||
});
|
});
|
||||||
|
|
||||||
program.parse();
|
program.parse();
|
||||||
|
|
2
ports/kitty/dist/kitty.conf
vendored
2
ports/kitty/dist/kitty.conf
vendored
|
@ -17,7 +17,7 @@ selection_background #C6E4F0
|
||||||
# Cursor colors
|
# Cursor colors
|
||||||
cursor #C6E4F0
|
cursor #C6E4F0
|
||||||
cursor_text_color #19323B
|
cursor_text_color #19323B
|
||||||
# cursor_trail_color none
|
cursor_trail_color #E1B392
|
||||||
####################
|
####################
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
|
|
@ -1,27 +1,12 @@
|
||||||
import { name, version } from '../info.toml'
|
|
||||||
import { license, url } from '../../../package.json'
|
|
||||||
import appRoot from 'app-root-path'
|
import appRoot from 'app-root-path'
|
||||||
import { rmFile, mkFilePath, appendToFile } from "../../../src/helpers/file"
|
import { rmFile, mkFilePath, appendToFile } from "../../../src/helpers/file"
|
||||||
import {
|
import { headerInfo, colorsBasic, colorsURLs, colorsCursor, colorsMarks, colorsTabBar, colorsBordersAndAlerts, colorsBasic16 } from './data'
|
||||||
pit,
|
|
||||||
depths,
|
|
||||||
stope,
|
|
||||||
text,
|
|
||||||
orange,
|
|
||||||
teal,
|
|
||||||
red,
|
|
||||||
yellow,
|
|
||||||
green,
|
|
||||||
blue,
|
|
||||||
purple,
|
|
||||||
} from '../../../src/palette'
|
|
||||||
|
|
||||||
const file = appRoot + '/ports/kitty/dist/kitty.conf'
|
const file = appRoot + '/ports/kitty/dist/kitty.conf'
|
||||||
|
|
||||||
const appendToKittyConf = async (content: string) => await appendToFile(file, content)
|
const appendToKittyConf = async (content: string) => await appendToFile(file, content)
|
||||||
|
|
||||||
export default async function(isVerbose = false): Promise<string> {
|
export default async function(isVerbose = false): Promise<string> {
|
||||||
console.log(file)
|
|
||||||
if (isVerbose) console.info('Kitty: Removing previous build', file)
|
if (isVerbose) console.info('Kitty: Removing previous build', file)
|
||||||
try {
|
try {
|
||||||
await rmFile(file)
|
await rmFile(file)
|
||||||
|
@ -44,122 +29,3 @@ export default async function(isVerbose = false): Promise<string> {
|
||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
function headerInfo(): string {
|
|
||||||
return `#########################
|
|
||||||
# ${name} for kitty
|
|
||||||
# ${version}
|
|
||||||
# ${license}
|
|
||||||
# ${url}
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsBasic(): string {
|
|
||||||
return `#########################
|
|
||||||
# The basic colors
|
|
||||||
foreground ${text.toHex()}
|
|
||||||
background ${pit.toHex()}
|
|
||||||
selection_foreground ${depths.toHex()}
|
|
||||||
selection_background ${text.toHex()}
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsCursor(): string {
|
|
||||||
return `#########################
|
|
||||||
# Cursor colors
|
|
||||||
cursor ${text.toHex()}
|
|
||||||
cursor_text_color ${depths.toHex()}
|
|
||||||
# cursor_trail_color none
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsURLs(): string {
|
|
||||||
return `#########################
|
|
||||||
# URL colors
|
|
||||||
url_color ${blue.toHex()}
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsBordersAndAlerts(): string {
|
|
||||||
return `#########################
|
|
||||||
# window border colors and terminal bell colors
|
|
||||||
active_border_color ${teal.toHex()}
|
|
||||||
inactive_border_color ${stope.toHex()}
|
|
||||||
bell_border_color ${orange.toHex()}
|
|
||||||
# visual_bell_color none
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsTabBar(): string {
|
|
||||||
return `#########################
|
|
||||||
# Tab bar colors
|
|
||||||
active_tab_foreground ${text.toHex()}
|
|
||||||
active_tab_background ${depths.toHex()}
|
|
||||||
inactive_tab_foreground ${text.toHex()}
|
|
||||||
inactive_tab_background ${stope.toHex()}
|
|
||||||
# tab_bar_background #{pit.toHex()}
|
|
||||||
# tab_bar_margin_color none
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsMarks(): string {
|
|
||||||
return `#########################
|
|
||||||
# Marks colors
|
|
||||||
# mark1_foreground black
|
|
||||||
# mark1_background #98d3cb
|
|
||||||
# mark2_foreground black
|
|
||||||
# mark2_background #f2dcd3
|
|
||||||
# mark3_foreground black
|
|
||||||
# mark3_background #f274bc
|
|
||||||
####################
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorsBasic16(): string {
|
|
||||||
return `#########################
|
|
||||||
# The basic 16 colors
|
|
||||||
#: black
|
|
||||||
color0 ${pit.toHex()}
|
|
||||||
color8 ${stope.toHex()}
|
|
||||||
|
|
||||||
#: red
|
|
||||||
color1 ${red.toHex()}
|
|
||||||
color9 ${red.toHex()}
|
|
||||||
|
|
||||||
#: green
|
|
||||||
color2 ${green.toHex()}
|
|
||||||
color10 ${green.toHex()}
|
|
||||||
|
|
||||||
#: yellow
|
|
||||||
color3 ${yellow.toHex()}
|
|
||||||
color11 ${yellow.toHex()}
|
|
||||||
|
|
||||||
#: blue
|
|
||||||
color4 ${blue.toHex()}
|
|
||||||
color12 ${blue.toHex()}
|
|
||||||
|
|
||||||
#: magenta
|
|
||||||
color5 ${purple.toHex()}
|
|
||||||
color13 ${purple.toHex()}
|
|
||||||
|
|
||||||
#: cyan
|
|
||||||
color6 ${teal.toHex()}
|
|
||||||
color14 ${teal.toHex()}
|
|
||||||
|
|
||||||
#: white
|
|
||||||
color7 ${text.toHex()}
|
|
||||||
color15 ${text.toHex()}
|
|
||||||
####################`
|
|
||||||
}
|
|
||||||
|
|
136
ports/kitty/src/data.ts
Normal file
136
ports/kitty/src/data.ts
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
import { name, version } from '../info.toml'
|
||||||
|
import { license, url } from '../../../package.json'
|
||||||
|
import {
|
||||||
|
pit,
|
||||||
|
depths,
|
||||||
|
stope,
|
||||||
|
text,
|
||||||
|
orange,
|
||||||
|
teal,
|
||||||
|
red,
|
||||||
|
yellow,
|
||||||
|
green,
|
||||||
|
blue,
|
||||||
|
purple,
|
||||||
|
} from '../../../src/palette'
|
||||||
|
|
||||||
|
export function headerInfo(): string {
|
||||||
|
return `#########################
|
||||||
|
# ${name} for kitty
|
||||||
|
# ${version}
|
||||||
|
# ${license}
|
||||||
|
# ${url}
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsBasic(): string {
|
||||||
|
return `#########################
|
||||||
|
# The basic colors
|
||||||
|
foreground ${text.toHex()}
|
||||||
|
background ${pit.toHex()}
|
||||||
|
selection_foreground ${depths.toHex()}
|
||||||
|
selection_background ${text.toHex()}
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsCursor(): string {
|
||||||
|
return `#########################
|
||||||
|
# Cursor colors
|
||||||
|
cursor ${text.toHex()}
|
||||||
|
cursor_text_color ${depths.toHex()}
|
||||||
|
cursor_trail_color ${yellow.toHex()}
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsURLs(): string {
|
||||||
|
return `#########################
|
||||||
|
# URL colors
|
||||||
|
url_color ${blue.toHex()}
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsBordersAndAlerts(): string {
|
||||||
|
return `#########################
|
||||||
|
# window border colors and terminal bell colors
|
||||||
|
active_border_color ${teal.toHex()}
|
||||||
|
inactive_border_color ${stope.toHex()}
|
||||||
|
bell_border_color ${orange.toHex()}
|
||||||
|
# visual_bell_color none
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsTabBar(): string {
|
||||||
|
return `#########################
|
||||||
|
# Tab bar colors
|
||||||
|
active_tab_foreground ${text.toHex()}
|
||||||
|
active_tab_background ${depths.toHex()}
|
||||||
|
inactive_tab_foreground ${text.toHex()}
|
||||||
|
inactive_tab_background ${stope.toHex()}
|
||||||
|
# tab_bar_background #{pit.toHex()}
|
||||||
|
# tab_bar_margin_color none
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsMarks(): string {
|
||||||
|
return `#########################
|
||||||
|
# Marks colors
|
||||||
|
# mark1_foreground black
|
||||||
|
# mark1_background #98d3cb
|
||||||
|
# mark2_foreground black
|
||||||
|
# mark2_background #f2dcd3
|
||||||
|
# mark3_foreground black
|
||||||
|
# mark3_background #f274bc
|
||||||
|
####################
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorsBasic16(): string {
|
||||||
|
return `#########################
|
||||||
|
# The basic 16 colors
|
||||||
|
#: black
|
||||||
|
color0 ${pit.toHex()}
|
||||||
|
color8 ${stope.toHex()}
|
||||||
|
|
||||||
|
#: red
|
||||||
|
color1 ${red.toHex()}
|
||||||
|
color9 ${red.toHex()}
|
||||||
|
|
||||||
|
#: green
|
||||||
|
color2 ${green.toHex()}
|
||||||
|
color10 ${green.toHex()}
|
||||||
|
|
||||||
|
#: yellow
|
||||||
|
color3 ${yellow.toHex()}
|
||||||
|
color11 ${yellow.toHex()}
|
||||||
|
|
||||||
|
#: blue
|
||||||
|
color4 ${blue.toHex()}
|
||||||
|
color12 ${blue.toHex()}
|
||||||
|
|
||||||
|
#: magenta
|
||||||
|
color5 ${purple.toHex()}
|
||||||
|
color13 ${purple.toHex()}
|
||||||
|
|
||||||
|
#: cyan
|
||||||
|
color6 ${teal.toHex()}
|
||||||
|
color14 ${teal.toHex()}
|
||||||
|
|
||||||
|
#: white
|
||||||
|
color7 ${text.toHex()}
|
||||||
|
color15 ${text.toHex()}
|
||||||
|
####################`
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue