fix: mush cmd

This commit is contained in:
2024-10-01 15:47:46 +03:00
parent b45fafd8ee
commit b62dd44af1
3 changed files with 13 additions and 13 deletions

View File

@@ -79,3 +79,5 @@ export async function getCommandOutput(
})
})
}
export const yellow = (s: string) => `\x1b[33m${s}\x1b[0m`

View File

@@ -2,18 +2,18 @@ import * as os from 'node:os'
import { MassargCommand } from 'massarg/command'
import { DF_DIR, HomeOpts } from './common'
import { massarg } from 'massarg'
import { runCommand } from '../common'
import { runCommand, yellow } from '../common'
const mushdir = `${os.homedir()}/Library/Application Support/CrossOver/Bottles/MushClient/drive_c/users/crossover/MUSHclient`
const backup = async (opts: HomeOpts) => {
await runCommand(opts, [
`rsync -vtr "${mushdir}" "${DF_DIR}/synced/"`,
`echo_yellow "Copied Mushclient profile to synced folder."`,
`git -C "${DF_DIR}" add "${DF_DIR}/synced/MUSHclient"`,
`git -C "${DF_DIR}" commit -m "backup: mushclient"`,
`git -C "${DF_DIR}" push`,
`echo_yellow "Backup complete."`,
`echo ${yellow('Copied Mushclient profile to synced folder.')}"`,
`git - C "${DF_DIR}" add "${DF_DIR}/synced/MUSHclient"`,
`git - C "${DF_DIR}" commit - m "backup: mushclient"`,
`git - C "${DF_DIR}" push`,
`echo ${yellow('Backup complete.')}"`,
])
}
const backupCommand = new MassargCommand<HomeOpts>({
@@ -29,7 +29,7 @@ const restoreCommand = new MassargCommand<HomeOpts>({
run: async (opts: HomeOpts) => {
await runCommand(opts, [
`rsync -vtr "${DF_DIR}/synced/MUSHclient/" "${mushdir}/"`,
`echo_yellow "Restored Mushclient profile from synced folder."`,
`echo "${yellow('Restored Mushclient profile from synced folder.')}"`,
])
},
})
@@ -43,12 +43,12 @@ const mapRestoreCommand = new MassargCommand<HomeOpts>({
const dest = 'Aardwolf.db'
await runCommand(opts, [
`echo_yellow "Renaming ${dest} to $bk"`,
`echo "${yellow(`Renaming ${dest} to ${bk}`)}"`,
`pushd "${mushdir}"`,
`mv "${dest}" "${bk}"`,
`echo_yellow "Copying ${mushdir}/db_backups/${src} to ${mushdir}/${dest}"`,
`echo "${yellow(`Copying ${mushdir}/db_backups/${src} to ${mushdir}/${dest}`)}"`,
`cp "db_backups/${src}" "${DF_DIR}/synced/MUSHclient/${dest}"`,
`echo_yellow "Done."`,
`echo "${yellow('Done.')}"`,
'popd',
])
},

View File

@@ -1,7 +1,7 @@
import { MassargCommand } from 'massarg/command'
import { DF_DIR, HomeOpts } from './common'
import { massarg } from 'massarg'
import { getCommandOutput, runCommand } from '../common'
import { getCommandOutput, runCommand, yellow } from '../common'
type SyncOpts = HomeOpts & {
message?: string
@@ -25,8 +25,6 @@ async function withSubmodules(fn: (sub: string) => Promise<void>, opts: SyncOpts
}
}
const yellow = (s: string) => `\x1b[33m${s}\x1b[0m`
const push = async (opts: SyncOpts) => {
const { message } = opts
console.log('Pushing submodules to origin')