def debug(config_id): program.load_cache() config = models.OlderConfig.get(config_id) monday = program.week_start_date() config.warnings = [] monday = datetime.combine(monday, datetime.min.time()) program.run(config, monday) config.save()
def get_started(config): """ Intended to get everything up and running for a first pass. This should run first. """ from main import load_auth from main import load_cache from main import update_quest_cache from habitica import api auth = load_auth(config) load_cache(config) update_quest_cache(config) hbt = api.Habitica(auth=auth) return auth, hbt
def cli(): """ Adapting cli... Usage: habitica [--version] [--help] <command> [<args>...] [--difficulty=<d>] [--verbose | --debug] Options: -h --help Show this screen --version Show version --difficulty=<d> (easy | medium | hard) [default: easy] --verbose Show some logging information --debug Some all logging information The habitica commands are: status Show HP, XP, GP, and more habits List habit tasks habits up <task-id> Up (+) habit <task-id> habits down <task-id> Down (-) habit <task-id> dailies List daily tasks dailies done Mark daily <task-id> complete dailies undo Mark daily <task-id> incomplete todos List todo tasks todos done <task-id> Mark one or more todo <task-id> completed todos add <task> Add todo with description <task> server Show status of Habitica service home Open tasks page in default browser For `habits up|down`, `dailies done|undo`, and `todos done`, you can pass one or more <task-id> parameters, using either comma-separated lists or ranges or both. For example, `todos done 1,3,6-9,11`. """ # set up args args = docopt(cli.__doc__, version=VERSION) # set up logging def verbose(): logging.basicConfig(level=logging.INFO) return def debug(): logging.basicConfig(level=logging.DEBUG) return logging.debug('Command line args: {%s}' % ', '.join("'%s': '%s'" % (k, v) for k, v in list(args.items()))) # Set up auth auth = load_auth(AUTH_CONF) # Prepare cache cache = load_cache(CACHE_CONF) # instantiate api service hbt = api.Habitica(auth=auth) return
def cli(): """ Adapting cli... Usage: habitica [--version] [--help] <command> [<args>...] [--difficulty=<d>] [--verbose | --debug] Options: -h --help Show this screen --version Show version --difficulty=<d> (easy | medium | hard) [default: easy] --verbose Show some logging information --debug Some all logging information The habitica commands are: status Show HP, XP, GP, and more habits List habit tasks habits up <task-id> Up (+) habit <task-id> habits down <task-id> Down (-) habit <task-id> dailies List daily tasks dailies done Mark daily <task-id> complete dailies undo Mark daily <task-id> incomplete todos List todo tasks todos done <task-id> Mark one or more todo <task-id> completed todos add <task> Add todo with description <task> server Show status of Habitica service home Open tasks page in default browser For `habits up|down`, `dailies done|undo`, and `todos done`, you can pass one or more <task-id> parameters, using either comma-separated lists or ranges or both. For example, `todos done 1,3,6-9,11`. """ # set up args args = docopt(cli.__doc__, version=VERSION) # set up logging def verbose(): logging.basicConfig(level=logging.INFO) return def debug(): logging.basicConfig(level=logging.DEBUG) return logging.debug('Command line args: {%s}' % ', '.join("'%s': '%s'" % (k, v) for k, v in args.items())) # Set up auth auth = load_auth(AUTH_CONF) # Prepare cache cache = load_cache(CACHE_CONF) # instantiate api service hbt = api.Habitica(auth=auth) return
def update_quest_cache(configfile, **kwargs): logging.debug('Updating (and caching) config data (%s)...' % configfile) cache = load_cache(configfile) for key, val in list(kwargs.items()): cache.set(SECTION_CACHE_QUEST, key, val) with open(configfile, 'wb') as f: cache.write(f) cache.read(configfile) return cache
def update_quest_cache(configfile, **kwargs): logging.debug('Updating (and caching) config data (%s)...' % configfile) cache = load_cache(configfile) for key, val in kwargs.items(): cache.set(SECTION_CACHE_QUEST, key, val) with open(configfile, 'wb') as f: cache.write(f) cache.read(configfile) return cache
def debug_main(day=date.today()): program.load_cache() program.main(day)