Skip to main content

a cli for mete

Project description

Code Health

This is a CLI for mete (or any other server supporting the Space-Market API v1).

Getting Started

Installation

Although this isn’t strictly needed you might want to install metecli first before using it.

Upgrading (or downgrading) is done the same way as installing.

Installing the current stable version

sudo -H pip3 install metecli

Installing the development version

  1. Clone this repository. (git clone https://github.com/YtvwlD/metecli.git)

  2. Install it. (sudo -H ./setup.py install)

Or just use it without installing

  1. Clone this repository. (git clone https://github.com/YtvwlD/metecli.git)

  2. Install the dependencies (either via your distribution’s package manager or via pip):

    1. requests

    2. PyYAML

    3. tabulate

    4. typing (not needed when running on Python 3.5 or newer)

  3. Start it. (./run.sh)

  4. Remember to mentally replace metecli with ./run.sh in the next sections.

Configuration

The initial configuration is done by calling metecli setup. You’ll see an exemplary invocation below:

$ metecli setup
Please enter the url for mete: http://mete/
The URL you entered doesn't use HTTPS. Do you want to try again? (y/n) n
WARNING:metecli.setup:Using HTTP. The connection won't be secure.
Do want to setup an account now? (y/n) y
Do you already have an account? (y/n) y
Please enter your username (or a part of it) or your uid: 1

metecli is now configured and ready.

a few use-cases

buy a drink

$ metecli account buy Mate

deposit money

$ metecli account deposit 2.50

show information about your account

$ metecli account show
+----------------------------------+---------+
| ID                               | 2       |
+----------------------------------+---------+
| name                             | test    |
+----------------------------------+---------+
| email                            |         |
+----------------------------------+---------+
| account balance                  | -1.50 € |
+----------------------------------+---------+
| active?                          | no      |
+----------------------------------+---------+
| log transactions?                | no      |
+----------------------------------+---------+
| redirect after buying something? | yes     |
+----------------------------------+---------+

modify your account

$ metecli account modify
name [test]:
email []: test@example.com
account balance [-1.5]:
active? [no]: yes
log transactions? [no]:
redirect after buying something? [yes]:

list your recent transactions

You’ll need to have the setting “log transactions” (audit) enabled for this to work.

$ metecli account logs
Audits for user 1:
+--------------------------+---------+--------------+
| time                     | drink   |   difference |
+==========================+=========+==============+
| 2017-09-11T09:01:23.816Z | Mate    |         -1.5 |
+--------------------------+---------+--------------+
| 2017-09-10T13:41:50.372Z | n/a     |         -5   |
+--------------------------+---------+--------------+

list all drinks

$ metecli drinks list
All drinks:
+------+---------+---------------+------------+---------+-----------+
|   ID | name    |   bottle size | caffeine   | price   | active?   |
+======+=========+===============+============+=========+===========+
|    1 | Mate    |           0.5 |            | 1.50 €  | yes       |
+------+---------+---------------+------------+---------+-----------+
|    2 | Cola    |           0   |            | 1.50 €  | yes       |
+------+---------+---------------+------------+---------+-----------+

display information about a drink

$ metecli drinks show Mate
+-------------+--------+
| ID          | 1      |
+-------------+--------+
| name        | Mate   |
+-------------+--------+
| price       | 1.50 € |
+-------------+--------+
| bottle size | 0.5    |
+-------------+--------+
| caffeine    |        |
+-------------+--------+
| active?     | yes    |
+-------------+--------+

modify a drink

$ metecli drinks modify Mate
name [Mate]:
price [1.5]:
bottle size [0.5]:
caffeine [None]: 100
active? [yes]:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

metecli-0.9.1-py2.py3-none-any.whl (33.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file metecli-0.9.1-py2.py3-none-any.whl.

File metadata

  • Download URL: metecli-0.9.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for metecli-0.9.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 536f34c26c3a888f6026802cee7cb4f12d785f288093b3dfe63f2fe42c9571e1
MD5 7443b6efff2f4f9b5d95a182ddca2e6e
BLAKE2b-256 1f64452174dcc9b2d367de4d6bce46331011145e407a6428313ab66be3ba66b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page