aboutsummaryrefslogtreecommitdiff
path: root/tabsvsspaces/_main.py
diff options
context:
space:
mode:
authorRoman Gräf <romangraef@loves.dicksinhisan.us>2020-06-21 02:44:06 +0200
committerRoman Gräf <romangraef@loves.dicksinhisan.us>2020-06-21 02:44:06 +0200
commit090b44edd8bf42e3d9574680dfa2e27cae8e595e (patch)
treec04a9bd456984218d84e7e4c5bb41c44055fff42 /tabsvsspaces/_main.py
parenta23529ccbd1237db2e7cbf5a8075437461fb5abe (diff)
downloadtabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.tar.gz
tabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.tar.bz2
tabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.zip
pypi release
Diffstat (limited to 'tabsvsspaces/_main.py')
-rw-r--r--tabsvsspaces/_main.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tabsvsspaces/_main.py b/tabsvsspaces/_main.py
new file mode 100644
index 0000000..b9f6389
--- /dev/null
+++ b/tabsvsspaces/_main.py
@@ -0,0 +1,31 @@
+import argparse
+from pathlib import Path
+
+from tabsvsspaces.pathtype import PathType
+from tabsvsspaces.find_stats import find_stats
+from tabsvsspaces.print_stats import print_stats
+from tabsvsspaces.stats import Statistics
+
+
+def main(args=None):
+ parser = argparse.ArgumentParser(
+ prog='tabsvsspaces',
+ description='Shows statistics about the usage of tabs and spaces in a given folder'
+ )
+ parser.add_argument('folder',
+ type=PathType(type='dir', exists=True))
+ parser.add_argument('--by-extension', '-e',
+ dest='extension',
+ action='store_true',
+ help='show distribution by file extension'
+ )
+ parser.add_argument('--verbose', '-v',
+ dest='verbose',
+ action='store_true',
+ help='show debug information')
+ ns = parser.parse_args(args)
+ folder: str = ns.folder
+ extension: bool = ns.extension
+ verbose: bool = ns.verbose
+ stats: Statistics = find_stats(Path(folder), verbose=verbose)
+ print_stats(stats, extension)