feat(docs): add yargs

This commit is contained in:
sd0 committed 2023-05-30 08:20:34 +08:00
1 parent 12266d760e
commit b752c82bf5
2 files changed
+11 -4

No files matched your search

@@ -5,13 +5,18 @@ import { Configuration, OpenAIApi } from 'openai'
import { inspect } from 'util'
import { v4 as uuidv4 } from 'uuid'
import { fetchSources } from './sources'
import yargs from 'yargs'
dotenv.config()
async function generateEmbeddings() {
// TODO: use better CLI lib like yargs
const args = process.argv.slice(2)
const shouldRefresh = args.includes('--refresh')
const argv = await yargs.option('refresh', {
alias: 'r',
description: 'Refresh data',
type: 'boolean',
}).argv
const shouldRefresh = argv.refresh
const requiredEnvVars = [
'NEXT_PUBLIC_SUPABASE_URL',