Metadata-Version: 2.3
Name: groupick
Version: 1.1.2.post3
Summary: Assign options to groups in the terminal with a simple GUI. Based on wong2's pick
License: The MIT License (MIT)
         
         Copyright (c) 2016 Wang Dàpéng
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Keywords: terminal,gui,pick,group,assign
Author: gc-av
Author-email: gc-av.dev@pm.me
Requires-Python: >=3.10
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Provides-Extra: dev
Requires-Dist: anytree (>=2.8,<3.0)
Requires-Dist: pytest (>=7.2.0,<8.0.0) ; extra == "dev"
Project-URL: Homepage, https://github.com/gc-av/groupick
Project-URL: Repository, https://github.com/gc-av/groupick
Description-Content-Type: text/markdown

# groupick

[![image](https://github.com/gc-av/groupick/actions/workflows/ci.yml/badge.svg)](https://github.com/gc-av/groupick/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/groupick.svg)](https://pypi.org/project/groupick/)
[![PyPI](https://img.shields.io/pypi/dm/groupick)](https://pypi.org/project/groupick/)

> [!WARNING]
>
> **This project is semi-abandoned.** If anyone is using it, submit an issue and I will check why the CI is failing.

**groupick** is a small python library based on [wong2's pick](https://github.com/wong2/pick) which allows you to create a curses-based interactive selection in the terminal. With **groupick** you can assign options to groups.

![](example/basic.gif)

## Installation

    $ pip install groupick

## Usage

**groupick** comes with a simple api:

    >>> from groupick import groupick

    >>> instructions = "Assign languages to groups 'a', 'b' or '1'."
    >>> options = ["Java", "JavaScript", "Python", "PHP", "C++", "Erlang", "Haskell"]
    >>> groups:set = {"a", "b", 1}
    >>> selected = groupick(options, groups, instructions, indicator="=>", default_index=2)
    >>> print(f"Here is your assignment: {selected}")

**output**:

    >>> {'1': [], 'a': [("JavaScript", 1)], 'b': []}

## Options

- `options`: a list of options to choose from
- `groups`: a list of ints and/or characters symbolising groups (max-length per item is 1)
- `instructions`: (optional) a title above options list
- `indicator`: (optional) custom the selection indicator, defaults to `*`
- `default_index`: (optional) index of item where cursor starts at by default
- `handle_all`: (optional) define whether it is mandatory to assign all options to groups, defaults to `False`
- `screen`: (optional), if you are using `groupick` within an existing curses application, pass your existing `screen` object. It is assumed this has initialised in the standard way (e.g. via `curses.wrapper()`, or `curses.noecho(); curses.cbreak(); screen.kepad(True)`)

## Community Projects

[wong2's pick](https://github.com/wong2/pick): Original pick project, for selecting one or more options (no grouping)

[pickpack](https://github.com/gc-av/pickpack): A fork of [`pick`](https://github.com/wong2/pick) to select tree data.

