Skip to content

Commit

Permalink
feat: basic support for passing cli parameters as arguments
Browse files Browse the repository at this point in the history
Example:

  setup-micromamba --micromamba-root-path micromamba debug --init-shell none --create-environment true --environment-file environment.yml --generate-run-shell true --micromamba-run-shell-path ./micromamba/run-shell --log-level debug
  • Loading branch information
thewtex committed Dec 7, 2023
1 parent 380f313 commit 660957a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
8 changes: 8 additions & 0 deletions dist/cli.js

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

8 changes: 8 additions & 0 deletions dist/index.js

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

8 changes: 8 additions & 0 deletions dist/post.js

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-micromamba",
"version": "1.7.0",
"name": "@thewtex/setup-micromamba",
"version": "1.9.0",
"description": "Setup micromamba to provide conda environments",
"bin": {
"setup-micromamba": "./dist/cli.js"
Expand Down
8 changes: 8 additions & 0 deletions src/mocking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ export const coreMocked = {
process.exit(1)
},
getInput: (name: string) => {
const optionFlag = `--${name}`
const cliFlagIndex = process.argv.indexOf(optionFlag)
if (cliFlagIndex > -1) {
const value = process.argv[cliFlagIndex + 1]
if (typeof value === 'string') {
return value
}
}
let value = process.env[`INPUT_${name.replace(/-/g, '_').toUpperCase()}`]
if (value === undefined) {
value = process.env[`${name.replace(/-/g, '_').toUpperCase()}`]
Expand Down

0 comments on commit 660957a

Please sign in to comment.