aiee

Python modules for common command line interfacing utils
git clone git://git.defalsify.org/aiee.git
Log | Files | Refs | LICENSE

commit fb0d688ae288e784d29f71b36787eb07f41f276d
parent 2fce9d7b05e3f5d324b64d1e3339eda12590123a
Author: lash <dev@holbrook.no>
Date:   Tue, 22 Feb 2022 19:25:45 +0000

Add forced integer output

Diffstat:
Maiee/numbers.py | 4++--
Maiee/runnable/main.py | 8+++++++-
Msetup.cfg | 7++++++-
3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/aiee/numbers.py b/aiee/numbers.py @@ -1,7 +1,7 @@ # standard imports import re -re_number_postfix = r'^(\d+(\.\d+)?)(([kmgtpezyE])(\d+)?)?$' +re_number_postfix = r'^(\d+(\.\d+)?)(([kmgtpezyE])(-?\d+)?)?$' def postfix_to_int(s): s = s.replace(' ', '') m = re.match(re_number_postfix, s) @@ -39,4 +39,4 @@ def postfix_to_int(s): elif m[4] == 'E': p += int(m[5]) - return v * (10 ** p) + return int(v * (10 ** p)) diff --git a/aiee/runnable/main.py b/aiee/runnable/main.py @@ -2,4 +2,10 @@ import sys from aiee.numbers import postfix_to_int -print(postfix_to_int(sys.argv[1])) + +def main(): + print(postfix_to_int(sys.argv[1])) + + +if __name__ == '__main__': + main() diff --git a/setup.cfg b/setup.cfg @@ -21,4 +21,9 @@ licence_files = [options] python_requires = >= 3.6 packages = - aiee.numbers + aiee + aiee.runnable + +[options.entry_points] +console_scripts = + aiee = aiee.runnable.main:main