Skip to content

Commit

Permalink
feat: detect env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed Nov 19, 2022
1 parent 653068e commit b1d6675
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {
type: 'text',
name: 'COURSE_SLUG',
message: 'The url of the course you want to download',
initial: 'https://frontendmasters.com/courses/...',
initial: env['FEM_DL_COURSE_URL'] || 'https://frontendmasters.com/courses/...',
validate: v => !v.endsWith('...') && FEM_COURSE_REG.test(v),
format: v => v.match(FEM_COURSE_REG)[2],
onState: exitOnCancel
Expand All @@ -43,6 +43,7 @@ const {
name: 'TOKEN',
message: 'Paste the value of "wordpress_logged_in_xxx" cookie (visit: frontendmasters.com)',
format: v => decodeURIComponent(v) === v ? encodeURIComponent(v) : v,
initial: env['FEM_DL_COOKIES'],
onState: exitOnCancel
}, {
type: 'select',
Expand All @@ -68,7 +69,7 @@ const {
type: 'text',
message: 'Download directory path',
name: 'DOWNLOAD_DIR',
initial: safeJoin(os.homedir(), 'Downloads'),
initial: env['FEM_DL_DOWNLOAD_PATH'] || safeJoin(os.homedir(), 'Downloads'),
validate: v => isPathExists(v),
onState: exitOnCancel
}])
Expand Down

0 comments on commit b1d6675

Please sign in to comment.