Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 27 additions & 30 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 46 additions & 29 deletions src/conda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,47 +419,64 @@ export async function condaInit(
}

// PowerShell profiles
let powerExtraText = `
# ----------------------------------------------------------------------------`;
// NOTE: Using array.join() to prevent auto-formatters from adding indentation
const powerLines: string[] = [
"",
"# ----------------------------------------------------------------------------",
];
if (isValidActivate) {
powerExtraText += `
# Conda Setup Action: Custom activation
conda activate "${inputs.activateEnvironment}"`;
powerLines.push(
"# Conda Setup Action: Custom activation",
`conda activate "${inputs.activateEnvironment}"`,
);
}
powerExtraText += `
# ----------------------------------------------------------------------------`;
powerLines.push(
"# ----------------------------------------------------------------------------",
);
const powerExtraText = powerLines.join("\n");

// Bash profiles
let bashExtraText: string = `
# ----------------------------------------------------------------------------
# Conda Setup Action: Basic configuration
set -eo pipefail`;
// NOTE: Using array.join() to prevent auto-formatters from adding indentation
const bashLines: string[] = [
"",
"# ----------------------------------------------------------------------------",
"# Conda Setup Action: Basic configuration",
"set -eo pipefail",
];
if (isValidActivate) {
bashExtraText += `
# Conda Setup Action: Custom activation
conda activate "${inputs.activateEnvironment}"`;
bashExtraText += `
# ----------------------------------------------------------------------------`;
bashLines.push(
"# Conda Setup Action: Custom activation",
`conda activate "${inputs.activateEnvironment}"`,
"# ----------------------------------------------------------------------------",
);
}
const bashExtraText = bashLines.join("\n");

// Batch profiles
let batchExtraText = `
:: ---------------------------------------------------------------------------`;
// NOTE: Using array.join() to prevent auto-formatters from adding indentation
const batchLines: string[] = [
"",
":: ---------------------------------------------------------------------------",
];
if (autoActivateDefault) {
batchExtraText += `
:: Conda Setup Action: Activate default environment
@CALL "%CONDA_BAT%" activate`;
batchLines.push(
":: Conda Setup Action: Activate default environment",
'@CALL "%CONDA_BAT%" activate',
);
}
if (isValidActivate) {
batchExtraText += `
:: Conda Setup Action: Custom activation
@CALL "%CONDA_BAT%" activate "${inputs.activateEnvironment}"`;
batchLines.push(
":: Conda Setup Action: Custom activation",
`@CALL "%CONDA_BAT%" activate "${inputs.activateEnvironment}"`,
);
}
batchExtraText += `
:: Conda Setup Action: Basic configuration
@SETLOCAL EnableExtensions
@SETLOCAL DisableDelayedExpansion
:: ---------------------------------------------------------------------------`;
batchLines.push(
":: Conda Setup Action: Basic configuration",
"@SETLOCAL EnableExtensions",
"@SETLOCAL DisableDelayedExpansion",
":: ---------------------------------------------------------------------------",
);
const batchExtraText = batchLines.join("\n");

const shells: types.IShells = {
"~/.bash_profile": bashExtraText,
Expand Down
Loading