Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require a config.json when using --help #188

Open
AndersBennedsgaard opened this issue Nov 15, 2024 · 0 comments
Open

Do not require a config.json when using --help #188

AndersBennedsgaard opened this issue Nov 15, 2024 · 0 comments

Comments

@AndersBennedsgaard
Copy link

Whenever you need additional information about a subcommand, you should not need to have run cognigy init. So I would say that the following also should skip checking the config if --help is used as an argument:

if (process.argv[2] !== "init" && process.argv[2]) {
if (!fs.existsSync(configFile)) {
console.error("No config.json file found. Please run cognigy init.");
process.exit(0);
} else {
const config = JSON.parse(fs.readFileSync(configFile).toString());
if (!config.agent || !config.apiKey || !config.baseUrl || !config.agentDir) {
console.log("config.json doesn't have all necessary fields (agent, baseUrl, apiKey, agentDir) defined.");
process.exit(0);
}
}
}

@AndersBennedsgaard AndersBennedsgaard changed the title Do not require a config.json for cognigy xxx --help Do not require a config.json when using --help Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant