Merge pull request 'Uses flit and pyproject.toml' (#7) from pyproject into main

Reviewed-on: micke/knotctl#7
main
Micke Nordin 5 months ago
commit 2346c2de2e

@ -3,11 +3,15 @@
This is a commandline tool for knotapi: https://gitlab.nic.cz/knot/knot-dns-rest This is a commandline tool for knotapi: https://gitlab.nic.cz/knot/knot-dns-rest
## Build and install ## Build and install
To install using pip, run the following command:
To install using pip, run the following command in a virtual envrionment.
``` ```
pip3 install git+https://code.smolnet.org/micke/knotctl python -m pip install "knotctl @ git+https://code.smolnet.org/micke/knotctl
``` ```
To build and install as a deb-package To build and install as a deb-package
``` ```
sudo apt install python3-stdeb sudo apt install python3-stdeb
git clone https://code.smolnet.org/micke/knotctl git clone https://code.smolnet.org/micke/knotctl
@ -18,25 +22,34 @@ sudo dpkg -i deb_dist/knotctl_*_all.deb
A prebuilt deb-package is also available from the release page: https://code.smolnet.org/micke/knotctl/releases/ A prebuilt deb-package is also available from the release page: https://code.smolnet.org/micke/knotctl/releases/
## Shell completion ## Shell completion
For bash: add this to .bashrc For bash: add this to .bashrc
``` ```
source <(knotctl completion) source <(knotctl completion)
``` ```
For fish, run: For fish, run:
``` ```
knotctl completion --shell fish > ~/.config/fish/completions/knotctl.fish knotctl completion --shell fish > ~/.config/fish/completions/knotctl.fish
``` ```
For tcsh: add this to .cshrc For tcsh: add this to .cshrc
``` ```
complete "knotctl" 'p@*@`python-argcomplete-tcsh "knotctl"`@' ; complete "knotctl" 'p@*@`python-argcomplete-tcsh "knotctl"`@' ;
``` ```
For zsh: add this to .zshrc For zsh: add this to .zshrc
``` ```
autoload -U bashcompinit autoload -U bashcompinit
bashcompinit bashcompinit
source <(knotctl completion) source <(knotctl completion)
``` ```
## Usage ## Usage
``` ```
usage: knotctl [-h] [--json | --no-json] usage: knotctl [-h] [--json | --no-json]
{add,completion,config,delete,list,update} ... {add,completion,config,delete,list,update} ...
@ -48,7 +61,9 @@ options:
-h, --help show this help message and exit -h, --help show this help message and exit
--json, --no-json --json, --no-json
``` ```
### ADD ### ADD
``` ```
usage: knotctl add [-h] -d DATA -n NAME -r RTYPE [-t TTL] -z ZONE usage: knotctl add [-h] -d DATA -n NAME -r RTYPE [-t TTL] -z ZONE
@ -60,7 +75,9 @@ options:
-t TTL, --ttl TTL -t TTL, --ttl TTL
-z ZONE, --zone ZONE -z ZONE, --zone ZONE
``` ```
### COMPLETION ### COMPLETION
``` ```
usage: knotctl completion [-h] [-s SHELL] usage: knotctl completion [-h] [-s SHELL]
@ -68,7 +85,9 @@ options:
-h, --help show this help message and exit -h, --help show this help message and exit
-s SHELL, --shell SHELL -s SHELL, --shell SHELL
``` ```
### CONFIG ### CONFIG
``` ```
usage: knotctl config [-h] [-c CONTEXT] [-b BASEURL] [-p PASSWORD] [-u USERNAME] usage: knotctl config [-h] [-c CONTEXT] [-b BASEURL] [-p PASSWORD] [-u USERNAME]
@ -79,7 +98,9 @@ options:
-p PASSWORD, --password PASSWORD -p PASSWORD, --password PASSWORD
-u USERNAME, --username USERNAME -u USERNAME, --username USERNAME
``` ```
### DELETE ### DELETE
``` ```
usage: knotctl delete [-h] [-d DATA] [-n NAME] [-r RTYPE] -z ZONE usage: knotctl delete [-h] [-d DATA] [-n NAME] [-r RTYPE] -z ZONE
@ -90,7 +111,9 @@ options:
-r RTYPE, --rtype RTYPE -r RTYPE, --rtype RTYPE
-z ZONE, --zone ZONE -z ZONE, --zone ZONE
``` ```
### LIST ### LIST
``` ```
usage: knotctl list [-h] [-d DATA] [-n NAME] [-r RTYPE] [-z ZONE] usage: knotctl list [-h] [-d DATA] [-n NAME] [-r RTYPE] [-z ZONE]
@ -101,7 +124,9 @@ options:
-r RTYPE, --rtype RTYPE -r RTYPE, --rtype RTYPE
-z ZONE, --zone ZONE -z ZONE, --zone ZONE
``` ```
### UPDATE ### UPDATE
``` ```
usage: knotctl update [-h] -a [ARGUMENT ...] -d DATA -n NAME -r RTYPE [-t TTL] usage: knotctl update [-h] -a [ARGUMENT ...] -d DATA -n NAME -r RTYPE [-t TTL]
-z ZONE -z ZONE

@ -0,0 +1,37 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
[project]
name="knotctl"
description="A CLI for knotapi."
authors = [
{name = "Micke Nordin", email = "hej@mic.ke"},
]
license= { file="LICENSE" }
readme= "README.md"
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
]
requires-python= ">=3.9"
version = "0.0.7"
dependencies = [
"argcomplete==2.0.0",
"pyyaml==6.0.1",
"requests==2.27.1",
"simplejson==3.17.6",
]
[project.urls]
Source="https://code.smolnet.org/micke/knotctl"
Documentation = "https://code.smolnet.org/micke/knotctl"
[project.scripts]
knotctl="knotctl:main"
[tool.flit.sdist]
include = ["LICENSE",]

@ -1,4 +1,4 @@
argcomplete==2.0.0 argcomplete==2.0.0
pyyaml==5.4.1 pyyaml==6.0.1
requests==2.27.1 requests==2.27.1
simplejson==3.17.6 simplejson==3.17.6

@ -1,26 +0,0 @@
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="knotctl",
version="0.0.7",
packages=setuptools.find_packages(),
author="Micke Nordin",
author_email="hej@mic.ke",
description="A cli for knotapi.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://code.smolnet.org/micke/knotctl",
project_urls={
"Bug Tracker": "https://code.smolnet.org/micke/knotctl/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GPL-3.0",
"Operating System :: OS Independent",
],
python_requires=">=3.9",
scripts=["scripts/knotctl"],
)
Loading…
Cancel
Save