fix: add a new line before/after the guard headers

This commit is contained in:
Amin Yahyaabadi 2024-08-16 00:29:37 -07:00
parent c0d283fa60
commit a06af07c8d
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
8 changed files with 38 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,8 +18,8 @@ export type RcOptions = {
async function sourceRCInRc_(options: RcOptions) { async function sourceRCInRc_(options: RcOptions) {
const sourceRcString = options.guard === undefined const sourceRcString = options.guard === undefined
? `source "${options.rcPath}"` ? `\nsource "${options.rcPath}"\n`
: `# ${options.guard}\nif [[ "$SOURCE_${options.guard.toUpperCase()}RC" != 0 && -f "${options.rcPath}" ]]; then source "${options.rcPath}"; fi` : `\n# ${options.guard}\nif [[ "$SOURCE_${options.guard.toUpperCase()}RC" != 0 && -f "${options.rcPath}" ]]; then source "${options.rcPath}"; fi\n`
try { try {
await Promise.all([ await Promise.all([
@ -40,8 +40,8 @@ export const sourceRCInRc = memoize(sourceRCInRc_, { isPromise: true })
async function addRCHeader(options: RcOptions) { async function addRCHeader(options: RcOptions) {
// a variable that prevents source rc from being called from .bashrc and .profile // a variable that prevents source rc from being called from .bashrc and .profile
const rcHeader = options.guard === undefined const rcHeader = options.guard === undefined
? "# Automatically Generated by os-env" ? "\n# Automatically Generated by os-env\n"
: `# Automatically Generated by os-env ${options.guard}\nexport SOURCE_${options.guard.toUpperCase()}RC=0` : `\n# Automatically Generated by os-env ${options.guard}\nexport SOURCE_${options.guard.toUpperCase()}RC=0\n`
if (await pathExists(options.rcPath)) { if (await pathExists(options.rcPath)) {
const rcContent = await readFile(options.rcPath, "utf8") const rcContent = await readFile(options.rcPath, "utf8")

View File

@ -16,7 +16,7 @@ let didUpdate: boolean = false
let didInit: boolean = false let didInit: boolean = false
// wait up to 300 seconds if the apt-get lock is held // wait up to 300 seconds if the apt-get lock is held
export const aptTimeout = "DPkg::Lock::Timeout=300" export const aptTimeout = "Dpkg::Lock::Timeout=300"
export type AptPackage = { export type AptPackage = {
name: string name: string