mirror of
https://github.com/dzeiocom/dotfiles.git
synced 2025-07-31 16:41:59 +00:00
14
modules/Fish.ts
Normal file
14
modules/Fish.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import SimpleModule from "../SimpleModule";
|
||||
import { getUserHome } from "../Functions";
|
||||
import FileInterface from "../FileInterface";
|
||||
|
||||
export default class Fish extends SimpleModule {
|
||||
files: FileInterface[] = [
|
||||
{
|
||||
displayName: "Functions",
|
||||
filename: "functions",
|
||||
path: `${getUserHome()}/.config/fish/functions`
|
||||
}
|
||||
]
|
||||
moduleName = "Fish"
|
||||
}
|
14
modules/HyperJS.ts
Normal file
14
modules/HyperJS.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import SimpleModule from "../SimpleModule";
|
||||
import { getUserHome } from "../Functions";
|
||||
import FileInterface from "../FileInterface";
|
||||
|
||||
export default class HyperJS extends SimpleModule {
|
||||
files: FileInterface[] = [
|
||||
{
|
||||
displayName: "Config",
|
||||
filename: "hyper.js.bak",
|
||||
path: `${getUserHome()}/.hyper.js`
|
||||
}
|
||||
]
|
||||
moduleName = "HyperJS"
|
||||
}
|
13
modules/Nano.ts
Normal file
13
modules/Nano.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import SimpleModule from "../SimpleModule"
|
||||
import FileInterface from "../FileInterface"
|
||||
import { getUserHome } from "../Functions"
|
||||
|
||||
export default class Nano extends SimpleModule {
|
||||
files: FileInterface[] = [
|
||||
{
|
||||
filename: "Nanorc",
|
||||
path: `${getUserHome()}/.nanorc`
|
||||
}
|
||||
]
|
||||
moduleName = "Nano"
|
||||
}
|
32
modules/OhMyFish.ts
Normal file
32
modules/OhMyFish.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import SimpleModule from "../SimpleModule"
|
||||
import FileInterface from "../FileInterface"
|
||||
import Requirements from "../Prerequises"
|
||||
import { execSync } from "child_process"
|
||||
|
||||
export default class OhMyFish extends SimpleModule {
|
||||
files: FileInterface[] = [
|
||||
{
|
||||
filename: "Extensions",
|
||||
prereqs: Requirements.INSTALLED,
|
||||
commands: {
|
||||
save: `${this.findCommand()} "omf list | tr '\\t' '\\n"' | grep '^[a-z-]' > {filepath}`,
|
||||
load: `${this.findCommand()} "omg install {line}"`
|
||||
}
|
||||
}
|
||||
]
|
||||
moduleName = "OhMyFish"
|
||||
|
||||
private findCommand(): string {
|
||||
try {
|
||||
execSync('which fish 2> /dev/null')
|
||||
execSync('which omf 2> /dev/null')
|
||||
return 'fish -c'
|
||||
} catch {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
async isInstalled(): Promise<boolean> {
|
||||
return this.findCommand() !== ""
|
||||
}
|
||||
}
|
79
modules/VSCode.ts
Normal file
79
modules/VSCode.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import SimpleModule from "../SimpleModule";
|
||||
import fsSync, { promises as fs } from "fs";
|
||||
import { getUserHome } from "../Functions";
|
||||
|
||||
import { execSync } from "child_process";
|
||||
import FileInterface from "../FileInterface";
|
||||
import Requirements from "../Prerequises";
|
||||
import 'colors'
|
||||
|
||||
export default class VSCode extends SimpleModule {
|
||||
files: FileInterface[] = [
|
||||
{
|
||||
displayName: "Settings",
|
||||
filename: "settings.json",
|
||||
path: `${this.findVSCodeFolder()}/User/settings.json`
|
||||
},
|
||||
{
|
||||
displayName: "Keybindings",
|
||||
filename: "keybindings.json",
|
||||
path: `${this.findVSCodeFolder()}/User/keybindings.json`
|
||||
},
|
||||
{
|
||||
displayName: "Snippets",
|
||||
filename: "snippets",
|
||||
path: `${this.findVSCodeFolder()}/User/snippets`
|
||||
},
|
||||
{
|
||||
displayName: "Extensions",
|
||||
filename: "extensions.txt",
|
||||
prereqs: Requirements.INSTALLED,
|
||||
commands: {
|
||||
save: `${this.findCommand()} --list-extensions`,
|
||||
load: `${this.findCommand()} --install-extension {line}`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
public moduleName: string
|
||||
|
||||
public constructor() {
|
||||
super()
|
||||
const filename = __filename.split("/")
|
||||
this.moduleName = filename[filename.length - 1].replace(".ts", "")
|
||||
}
|
||||
|
||||
private static commands = ["vscodium", "vscode", "code", "codium"]
|
||||
|
||||
private findVSCodeFolder(): string {
|
||||
const possibilities = [
|
||||
`${getUserHome()}/.config/Code`,
|
||||
`${getUserHome()}/.config/VSCodium`,
|
||||
`${getUserHome()}/.config/Code - OSS`,
|
||||
]
|
||||
for (const pos of possibilities) {
|
||||
try {
|
||||
fsSync.accessSync(pos)
|
||||
return pos
|
||||
} catch {continue}
|
||||
}
|
||||
return possibilities[0] // default to VSCode folder
|
||||
}
|
||||
|
||||
private findCommand(): string {
|
||||
for (const cmd of VSCode.commands) {
|
||||
try {
|
||||
execSync(`which ${cmd}`)
|
||||
return cmd
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
public async isInstalled(): Promise<boolean> {
|
||||
return this.findCommand() !== ""
|
||||
}
|
||||
|
||||
}
|
13
modules/Yarn.ts
Normal file
13
modules/Yarn.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import SimpleModule from "../SimpleModule";
|
||||
import { getUserHome } from "../Functions";
|
||||
import FileInterface from "../FileInterface";
|
||||
|
||||
export default class Yarn extends SimpleModule {
|
||||
files: FileInterface[] = [
|
||||
{
|
||||
filename: "yarnrc",
|
||||
path: `${getUserHome()}/.yarnrc`
|
||||
}
|
||||
]
|
||||
moduleName = "Yarn"
|
||||
}
|
Reference in New Issue
Block a user