command :config do |c| c.syntax = 'brief config [options]' c.description = 'manipulate brief configuration settings' c.action do |args, options| Brief::Configuration.initialize! # Setting a value manually if args.first == 'set' args.slice(1, args.length).map(&:strip).each do |pair| key, value = pair.split('=') Brief.configuration.set(key, value, false) end Brief.configuration.save! end if args.empty? && !(Brief.config.github_username || Brief.config.github_token) args.push "github" end if args.first == "github" username = ask("What is your github username: ", String) say "If you haven't generated a personal access token yet, do so here: https://github.com/settings/tokens/new" access_token = ask("Enter your private access token: ") if username Brief.config.set "github_username", username end if access_token # TODO # We could validate the token for them. Brief.config.set "github_token", access_token end end end end