mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Log cli options as object
This commit is contained in:
parent
5211fdd01a
commit
342bdab21f
1 changed files with 8 additions and 8 deletions
|
|
@ -26,10 +26,10 @@ import { makeSearchableList } from './helpers/searchable-list.js'
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
const commandArguments = process.argv
|
const commandArguments = process.argv
|
||||||
|
const cliOptions = {
|
||||||
|
withApi: commandArguments.includes('--with-api'),
|
||||||
const withApi = commandArguments.includes('--with-api')
|
noLists: commandArguments.includes('--no-lists'),
|
||||||
const noLists = commandArguments.includes('--no-lists')
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ class BuildLists {
|
||||||
// Run all listsOprions methods
|
// Run all listsOprions methods
|
||||||
// and store them to this.lists
|
// and store them to this.lists
|
||||||
async buildLists () {
|
async buildLists () {
|
||||||
console.log( 'Build Lists started', commandArguments )
|
console.log( 'Build Lists started', cliOptions )
|
||||||
|
|
||||||
|
|
||||||
for ( const listOptions of this.listsOptions ) {
|
for ( const listOptions of this.listsOptions ) {
|
||||||
|
|
@ -252,7 +252,7 @@ class BuildLists {
|
||||||
|
|
||||||
const listOptions = this.listsOptions[listOptionsKey]
|
const listOptions = this.listsOptions[listOptionsKey]
|
||||||
|
|
||||||
if ( !noLists ) {
|
if ( !cliOptions.noLists ) {
|
||||||
await this.saveList( listOptions )
|
await this.saveList( listOptions )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ class BuildLists {
|
||||||
|
|
||||||
console.timeEnd(methodName)
|
console.timeEnd(methodName)
|
||||||
|
|
||||||
if ( withApi ) {
|
if ( cliOptions.withApi ) {
|
||||||
console.log('Saving individual endpoints...')
|
console.log('Saving individual endpoints...')
|
||||||
|
|
||||||
const endpointMethodName = `Saved /${ listOptions.name } endpoints`
|
const endpointMethodName = `Saved /${ listOptions.name } endpoints`
|
||||||
|
|
@ -388,7 +388,7 @@ class BuildLists {
|
||||||
// ['/app/chrome', this.endpointMaps.eleventy.get( '/app/chrome' )]
|
// ['/app/chrome', this.endpointMaps.eleventy.get( '/app/chrome' )]
|
||||||
// ])
|
// ])
|
||||||
|
|
||||||
if ( !withApi ) {
|
if ( !cliOptions.withApi ) {
|
||||||
for ( const [ endpointSetName, endpointSet ] of Object.entries(this.endpointMaps) ) {
|
for ( const [ endpointSetName, endpointSet ] of Object.entries(this.endpointMaps) ) {
|
||||||
// Save Endpoints
|
// Save Endpoints
|
||||||
await this.saveToJson(Array.from( endpointSet , ([route, payload]) => ({ route, payload })), `./static/${endpointSetName}-endpoints.json`)
|
await this.saveToJson(Array.from( endpointSet , ([route, payload]) => ({ route, payload })), `./static/${endpointSetName}-endpoints.json`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue