A command line interface to buy things in stregsystemet

Overview

Stregsystemet-CLI

This repository is the Stregsystemet CLI, to buy things in Stregsystemet, at AAU. Use of this cli-tool is at your own risk and there will be no support guarranteed. Either try to resolve the issue yourself and submit a PR or write an issue.

Requirements

The CLI is a python script that relies on no external dependendencies. The script is tested with python 3.9

Installation

To install the script, simply cURL or wget it from GitHub

wget https://raw.githubusercontent.com/f-klubben/stregsystemet-cli/master/main.py -O sts

Usage

$ sts -h
usage: sts [-h] [-u [USER]] [-i [ITEM]] [-c [COUNT]] [-b] [-l] [product]

positional arguments:
  product               Specifies the product to buy

optional arguments:
  -h, --help            show this help message and exit
  -u [USER], --user [USER]
                        Specifies your Stregsystem username
  -i [ITEM], --item [ITEM]
                        Specifies the item you wish to buy
  -c [COUNT], --count [COUNT]
                        Specifies the amount of items you wish to buy
  -b, --balance         Output only stregdollar balance

  -l, --history         Shows your recent purchases

If either the user or item arguments or no arguments at all are specified the CLI will enter interactive mode.

The script also keeps track of your balance and what items are available in Stregsystemet.

Contributions

Contributions are welcome!

Feel free to fork the project and create a pull request. To get started with a development environment of Stregsystemet, go to the official Stregsystemet repository

Comments
  • Purchase multiple wares in one go

    Purchase multiple wares in one go

    The feature makes it possible to purchase multiple wares in one go. E.g.:

    sts -u username øl+monster+panta:2
    

    (Results in purchase of one monster and beer + 2x pant a)

    Notes:

    • If the count is not specified for a ware it will default to the value given by the -c flag or 1 (in that order)
      e.g.: sts -u username -c 2 monster+panta will purchase 2x monster and panta
    • If a unknown shorthand is used the entire purchase will be canceled (not just that of the unknown item)
    hacktoberfest-accepted 
    opened by jonasKjellerup 3
  • Separate functionality - Creation of stslib.py

    Separate functionality - Creation of stslib.py

    Currently I'm trying to create a rofi script for STS. In this regard, I would like to use the get-wares-functionality. However this function is tightly bound to the main python file. I suggest splitting the functionality into the following files:

    • stslib.py - A general library containing interaction with stregsystemet. So: test_user, get_wares, get_history, sale and possibly get_qr
    • sts.py - The current implemention, but calling the library instead
    • sts-strandvejen.py - The special case of the strandvejen

    And here is where I would be able to create sts-rofi.py which interacts with rofi.

    This split does however come with a drawback: The update script needs to support updating multiple files.

    Currently it is only a suggestion. I don't know if there is even any support a change like this.

    opened by joandrsn 2
  • Add plugin system to STS for more hackiness

    Add plugin system to STS for more hackiness

    This pull request adds a plugin system to STS, such that the user can customise their sts to their liking

    Customisation includes:

    • Adding new shorthands
    • Adding new commands
    • Add new functionality

    Commits in pr:

    • Added template plugins
    • Added plugin system
    • Updated gitignore
    opened by Zaph-x 2
  • Removed dateutil as dependency

    Removed dateutil as dependency

    • Fixed issue where shorthands would not be parsed in strandvejen
    • Add dateutils as a nix dependency
    • Stop config crashing when no config file is present
    • Fixed accidental dependency
    • Removed import statement
    opened by Zaph-x 1
  • Plugin help message suggestion does not work

    Plugin help message suggestion does not work

    STS writes the following when 'plugin_dir' is not set: STS now supports plugins. Add "plugin_dir=~/.sts_plugins/" to your .sts file

    However, (on my system at least) the expansion of home (~) does not work and I have to give it a FQN (/home/$user/.config/sts/plugins/etc).

    Having some way to supress the "heyo, we got plugins" message without having to setup plugins would be nice, since you can know of the support but choose not to use it.

    opened by falkecarlsen 1
  • Error running sts following the setup -s process

    Error running sts following the setup -s process

    Running the setup -s process creates a .sts file containing two [sts], resulting in an error the next time you run "sts".

    Terminal:

    sts -s
    Hvad er dit bruger navn? <Username>
    

    ~/.sts

    [sts]
    [sts]
    <username>
    

    To fix the problem i removed one instance of [sts] in the .sts file.

    ~/.sts

    - [sts]
      [sts]
      <username>
    
    opened by JSJCoding 1
  • NameError on Windows system after entering username

    NameError on Windows system after entering username

    Running the Stregsystem CLI on Windows results in the following error: NameError: name 'is_windows_terminal' is not defined

    This can be fixed if the reference to is_windows_terminal is replaced with is_windows. I imagine that short-circuiting prevents the error from being found from a Linux system.

    bug 
    opened by Beigevenus 1
  • CTRL+D should not throw EOFError

    CTRL+D should not throw EOFError

    ctrl+d in most shells issue an EOF character, which is a relatively universal way of ending a shell or other text input (like the buy menu in sts). We should just gracefully handle this character and exit.

    Id> Traceback (most recent call last):
    File "/bin/sts", line 416, in <module>
        main()
    File "/bin/sts", line 400, in main
        user_buy(args.user)
    File "/bin/sts", line 294, in user_buy
        item, count = get_item([x[0] for x in wares])
    File "/bin/sts", line 260, in get_item
        item_id = input('Id> ')
        
    EOFError
    
    opened by SEbbaDK 1
  • Add packaging for nix

    Add packaging for nix

    Adding the default.nix file makes it super easy to add sts to any system running the nix package manager. It also means development of sts only requires running nix-shell to have the dependencies installed.

    hacktoberfest-accepted 
    opened by SEbbaDK 1
  • Remove HTML tags from products

    Remove HTML tags from products

    It would be nice if the HTML tags used to highlight products would removed from the CLI as it just looks bad (Such as <h1>). Alternatively the products with html tags could also be used to change the formatting of products with these tags.

    opened by JohanThomsen 1
  • Setup flag

    Setup flag

    Currently, not many people know about the .sts files. It would be beneficial for the user to be able to generate it automatically, with correct formatting.

    As a user I want to have a setup flag that generates a .sts file So it is placed in the right directory

    opened by Zaph-x 1
  • Unable to run SETUP flag on clean install

    Unable to run SETUP flag on clean install

    When creating a new installation of STS, running the -s flag produces the following stacktrace:

    Traceback (most recent call last):
      File "/opt/homebrew/bin/sts", line 1032, in <module>
        sts.load()
      File "/opt/homebrew/bin/sts", line 643, in load
        self._argument_handler.handle_stopping(self, self._user_manager, self._request_handler)
      File "/opt/homebrew/bin/sts", line 296, in handle_stopping
        self.setup_sts(user_manager, request_handler, Configuration())
      File "/opt/homebrew/bin/sts", line 395, in setup_sts
        configuration.write()
      File "/opt/homebrew/bin/sts", line 162, in write
        with open(paths[0], 'w') as configfile:
    IndexError: list index out of range
    

    This has been tested on MacOS

    good first issue 
    opened by Zaph-x 0
  • Add a --dry-run option to the tool

    Add a --dry-run option to the tool

    For new users who are unfamiliar with the code, they might want to explore what the tool can do.

    I would suggest adding a --dry-run option for the script. Example usage:

    $ sts classic --dry-run
    Username 'abba' would purchase 1x 14 Øl(Grøn/Classic/Rød/Rå) (excl. pant) for 6.67 kr
    

    Another example:

    $ sts -u johannes 1837 --dry-run
    Username 'johannes' would purchase 1x 1837 Monster / cola energy (excl. pant) for 12.10 kr
    

    More reading on general usage of --dry-run here

    good first issue 
    opened by joandrsn 0
Owner
F-klubben
F-klubben
A supercharged AWS command line interface (CLI).

SAWS Motivation AWS CLI Although the AWS CLI is a great resource to manage your AWS-powered services, it's tough to remember usage of: 70+ top-level c

Donne Martin 5.1k Jan 5, 2023
Command line interface for testing internet bandwidth using speedtest.net

speedtest-cli Command line interface for testing internet bandwidth using speedtest.net Versions speedtest-cli works with Python 2.4-3.7 Installation

Matt Martz 12.4k Jan 8, 2023
Universal Command Line Interface for Amazon Web Services

This package provides a unified command line interface to Amazon Web Services.

Amazon Web Services 13.3k Jan 7, 2023
command line interface to manage VALORANT skins

A PROPER RELEASE IS COMING SOON, IF YOU KNOW HOW TO USE PYTHON YOU CAN USE IT NOW! valorant skin manager command line interface simple command line in

colinh 131 Dec 25, 2022
Microsoft Azure CLI - Azure Command-Line Interface

A great cloud needs great tools; we're excited to introduce Azure CLI, our next generation multi-platform command line experience for Azure.

Microsoft Azure 3.4k Dec 30, 2022
flora-dev-cli (fd-cli) is command line interface software to interact with flora blockchain.

Install git clone https://github.com/Flora-Network/fd-cli.git cd fd-cli python3 -m venv venv source venv/bin/activate pip install -e . --extra-index-u

null 14 Sep 11, 2022
moviepy-cli: Command line interface for MoviePy.

Moviepy-cli is designed to apply several video editing in a single command with Moviepy as an alternative to Video-cli.

Kentaro Wada 23 Jun 29, 2022
Command line interface for unasync

CLI for unasync Command line interface for unasync Getting started Install Run the following command to install the package with pip: pip install unas

Leynier Gutiérrez González 3 Apr 4, 2022
Rover is a command line interface application that allows through browse through mission data, images, metadata from the NASA Official Website

?? rover Rover is a command line interface application that allows through browse through mission data, images, metadata from the NASA Official Websit

Saketha Ramanjam 4 Jan 19, 2022
bsp_tool provides a Command Line Interface for analysing .bsp files

bsp_tool Python library for analysing .bsp files bsp_tool provides a Command Line Interface for analysing .bsp files Current development is focused on

Jared Ketterer 64 Dec 28, 2022
Investing library and command-line interface inspired by the Bogleheads philosophy

Lakshmi (Screenshot of the lak command in action) Background This project is inspired by Bogleheads forum. Bogleheads focus on a simple but powerful p

Sarvjeet Singh 108 Dec 26, 2022
⚙ A lightweight command line interface library for creating commands.

⚙ A lightweight command line interface library for creating cli commands. About | Installation | Usage | Features | Contributors | License About Next:

Serum 16 Sep 25, 2022
Command-line interface to PyPI Stats API to get download stats for Python packages

pypistats Python 3.6+ interface to PyPI Stats API to get aggregate download statistics on Python packages on the Python Package Index without having t

Hugo van Kemenade 140 Jan 3, 2023
A minimal and ridiculously good looking command-line-interface toolkit.

Pyceo Pyceo is a Python package for creating beautiful, composable, and ridiculously good looking command-line-user-interfaces without having to write

Juan-Pablo Scaletti 21 Mar 25, 2022
Quo is a Python based toolkit for writing Command-Line Interface(CLI) applications.

Quo is a Python based toolkit for writing Command-Line Interface(CLI) applications. Quo is making headway towards composing speedy and orderly CLI applications while forestalling any disappointments brought about by the failure to execute a CLI API. Simple to code, easy to learn, and does not come with needless baggage.

Secretum Inc. 16 Oct 15, 2022
The command line interface for Gradient - Gradient is an an end-to-end MLOps platform

Gradient CLI Get started: Create Account • Install CLI • Tutorials • Docs Resources: Website • Blog • Support • Contact Sales Gradient is an an end-to

Paperspace 58 Dec 6, 2022
Program Command Line Interface (CLI) Sederhana: Pemesanan Nasi Goreng Hekel

Program ini merupakan aplikasi yang berjalan di dalam command line (terminal). Program ini menggunakan built-in library python yaitu argparse yang dapat menerima parameter saat program ini dijalankan melalui terminal atau CLI.

Habib Abdurrasyid 5 Nov 19, 2021
A command line interface to interact with the Hypixel api allowing the user to get stats, leaderboards, etc

HyConsole is a way to get data on players and leaderboards from the Hypixel Minecraft server from the command line. Keep in mind I have no a

null 1 Feb 14, 2022
A collection of command-line interface games written in python

Command Line Interface Python Games Collection of some starter python game projects for beginners How to play these games Clone this repository git cl

Paras Gupta 7 Jun 6, 2022