# Hopla
[![hopla](https://img.shields.io/static/v1?label=melvio&message=hopla&color=blue&logo=github)](https://github.com/melvio/hopla)
[![stars - hopla](https://img.shields.io/github/stars/melvio/hopla?style=social)](https://github.com/melvio/hopla)
[![Continuous Integration](https://github.com/melvio/hopla/actions/workflows/ci-lint-and-test.yml/badge.svg)](https://github.com/melvio/hopla/actions/workflows/ci-lint-and-test.yml)
hopla - a command line interface (CLI) for [habitica.com](https://habitica.com)
Hopla is a XDG-compliant CLI which uses `python3` to interact with
the [Habitica API](https://habitica.com/apidoc/).
Hopla is currently under active development so new features are added rapidly.
## How to Use Hopla
### Installation
Hopla can be installed by running the following command:
```bash
python3 -m pip install --user hopla-cli
```
### First Time Usage
Hopla needs your `User Id` and `API Token` to connect to Habitica.
You can find these over at `https://habitica.com/user/settings/api`.
Run the following command to configure this automatically:
```bash
$ hopla authenticate
Please enter your credentials.
You can find them over at <https://habitica.com/user/settings/api>.
They have the following format: 'c0ffee69-dada-feed-abb1-5ca1ab1ed004'.
The user id can be found under 'User ID'.
Please paste your user ID here (press Ctrl-C to abort): c0ffee69-dada-feed-abb1-5ca1ab1ed004
Please paste your user API Token here (input remains hidden):
```
This will create a credentials file at `~/.config/hopla/authenticate.conf` that Hopla uses.
If you want to use a different file, you can set the `${HOPLA_AUTH_FILE}` environment
variable to choose your own file.
##### Autocompletion
If you want bash autocompletion, you can run the following command:
```bash
$ hopla complete bash --enable
enabled autocompletion
restart bash to make use of it
```
To make use of the autocompletion you need to reload your bashrc.
You can do this by either opening up a new terminal window, or
running `bash` again, or running `source ~/.bashrc`.
To print the autocomplete code for bash|zsh|fish, so that you can install
it yourself, optionally run:
```bash
# optionally, install the autocomplete code yourself:
hopla complete bash
hopla complete zsh
hopla complete fish
```
## Everyday Usage
After installation, you can use `hopla`.
The supported commands can be found by running:
```bash
$ hopla --help
Usage: hopla [OPTIONS] COMMAND [ARGS]...
hopla - a command line interface (CLI) to interact with habitica.com
Options:
--version Show the version and exit.
-h, --help Show this message and exit.
Commands:
add GROUP for adding things to Habitica.
api GROUP for requesting Habitica API metadata.
authenticate Authorize yourself to access the Habitica.com API.
buy GROUP to buy things.
complete Print or enable shell autocompletion.
# etcetera
```
More functionality is currently being implemented.
Hopla is open-source.
Pull request, feature requests, and issues are welcomed at <https://github.com/melvio/hopla>.
If you want to contribute, but don't know where to start, you might want to look at
`.github/CONTRIBUTING.md` and the `./developers` folder.
[![License](https://img.shields.io/badge/License-apache--2.0-blue)](#license)
### Environment Variables for Hopla's options
*Use case*: You can use environment variables to set default values for all Hopla options.
Hopla automatically recognizes environment variables starting with `HOPLA_`.
All option (such as `--difficulty` for `hopla add todo` and `--times` for `hopla feed`) can be
set in this manner.
To get the right environment variable name, use this logic:
1. Define an environment variable starting with `HOPLA_`
2. Append the subcommand to the environment variable as follows:
* `hopla add todo` -> `HOPLA_ADD_TODO_`
* `hopla support-development` -> `HOPLA_SUPPORT_DEVELOPMENT_`
* `hopla feed` -> `HOPLA_FEED_`
3. Append the option name that you want to set as follows:
* `hopla add todo --difficulty` -> `HOPLA_ADD_TODO_DIFFICULTY`
* `hopla support-development --gems` -> `HOPLA_SUPPORT_DEVELOPMENT_GEMS`
* `hopla feed --times` -> `HOPLA_FEED_TIMES`
For example:
```bash
HOPLA_ADD_TODO_DIFFICULTY=hard hopla add todo "Hello"
HOPLA_SUPPORT_DEVELOPMENT_GEMS=8 hopla support-development
HOPLA_FEED_AMOUNT=3 hopla feed Wolf-Shade Chocolate
````
Other examples:
```bash
# add a To-Do for today
HOPLA_ADD_TODO_DUE_DATE=today hopla add todo "Task with Deadline from today"
# automatically enable autocomplete for bash
HOPLA_COMPLETE_ENABLE=true hopla complete bash
HOPLA_COMPLETE_ENABLE=yes hopla complete bash
HOPLA_COMPLETE_ENABLE=1 hopla complete bash
# only print autocomplete for bash
HOPLA_COMPLETE_ENABLE=0 hopla complete bash
HOPLA_COMPLETE_ENABLE=false hopla complete bash
HOPLA_COMPLETE_ENABLE=no hopla complete bash
```
### Background
Hopla is a XDG-compliant bash-based command line interface (CLI).
It was created because no other CLI supported the creation of To-Dos with both a
due date and a checklist.
Hopla provides the following command to create these with the following command:
```bash
# Add a hard To-Do. Every line in the specified file will being added as
# an item of this To-Do's checklist.
hopla add todo --difficulty hard \
--due-date 2027-12-07 \
--checklist ./my_todo.txt \
"my todo name here"
```
The most simple way to add a To-Do would be to run `hopla add todo` without arguments.
Hopla will then prompt you for a To-Do name:
```bash
$ hopla add todo
Please provide a name for your todo: Feed the dog
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共132个文件
py:122个
txt:5个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:hopla-cli-0.0.28a0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
Python库 | hopla-cli-0.0.28a0.tar.gz (132个子文件)
setup.cfg 1KB
README.md 6KB
PKG-INFO 7KB
PKG-INFO 7KB
test_info.py 27KB
petdata.py 23KB
test_petmodels.py 18KB
test_hatchalgorithm.py 14KB
test_feed.py 12KB
test_foodmodels.py 11KB
test_throttling.py 10KB
test_get_group.py 9KB
test_zoofeeding_algorithms.py 9KB
petmodels.py 9KB
test_eggmodels.py 9KB
complete.py 8KB
test_hatchpotionmodels.py 8KB
foodmodels.py 7KB
feed.py 7KB
throttling.py 7KB
todo.py 7KB
configuration.py 7KB
test_feed_all.py 7KB
test_hatch_all.py 6KB
authorization.py 6KB
test_zoomodels.py 6KB
test_cast.py 6KB
request.py 5KB
test_todo.py 5KB
hatchalgorithms.py 5KB
test_request.py 5KB
zoofeed_algorithms.py 5KB
enchanted_armoire.py 4KB
kickstart.py 4KB
test_petdata.py 4KB
hatch_all.py 4KB
test_enchanted_armoire.py 4KB
test_usermodels.py 4KB
feed_all.py 4KB
eggmodels.py 4KB
api.py 4KB
zoomodels.py 4KB
taskmodel.py 3KB
config.py 3KB
usermodels.py 3KB
hatchpotionmodels.py 3KB
spellmodel.py 3KB
hatchdata.py 3KB
info.py 3KB
cast.py 3KB
test_petcontroller.py 3KB
http.py 3KB
get_group.py 2KB
test_standard_egg.py 2KB
stats.py 2KB
petcontroller.py 2KB
test_quest_egg.py 2KB
test_spellmodel.py 2KB
auth.py 2KB
common.py 2KB
test_kickstarter.py 2KB
inventory.py 2KB
support_development.py 2KB
set.py 2KB
test_hoplaversion.py 2KB
test_stats.py 2KB
authenticate.py 2KB
fooddata.py 2KB
hoplaversion.py 2KB
standard_egg.py 1KB
test_requests_helper.py 1KB
buy_controllers.py 1KB
errors.py 1KB
quest_egg.py 1KB
test_outputformatter.py 1KB
usercontroller.py 1KB
requests_helper.py 1024B
test_errors.py 1022B
hatchcontroller.py 883B
__init__.py 880B
hatch.py 873B
taskcontroller.py 863B
feed_clickhelper.py 860B
user_test_utils.py 856B
castcontroller.py 809B
test_complete.py 630B
get_user.py 609B
test_hatchcontroller.py 581B
outputformatter.py 566B
hopla_option.py 534B
test_castcontroller.py 504B
version.py 369B
setup.py 352B
test_buy_controllers.py 316B
__main__.py 267B
test_hopla_option.py 264B
test_classmodels.py 244B
add.py 208B
__init__.py 176B
buy.py 160B
共 132 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 12w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功