wgc
Version:
The official CLI tool to manage the GraphQL Federation Platform Cosmo
20 lines • 659 B
JavaScript
import { Command } from 'commander';
import Whoami from './commands/whoami.js';
import Login from './commands/login.js';
import Logout from './commands/logout.js';
import { checkAuth } from './utils.js';
export default (opts) => {
const schema = new Command('auth');
schema.description('Provides commands for authentication.');
schema.addCommand(Whoami(opts));
schema.addCommand(Login(opts));
schema.addCommand(Logout(opts));
schema.hook('preAction', async (thisCmd) => {
if (thisCmd.args[0] === 'login') {
return;
}
await checkAuth();
});
return schema;
};
//# sourceMappingURL=index.js.map