Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python3 

2# -*- coding: utf-8; mode: python; -*- 

3# Copyright © 2020-2021 Pradyumna Paranjape 

4# 

5# This file is part of xdgpspconf. 

6# 

7# xdgpspconf is free software: you can redistribute it and/or modify 

8# it under the terms of the GNU Lesser General Public License as published by 

9# the Free Software Foundation, either version 3 of the License, or 

10# (at your option) any later version. 

11# 

12# xdgpspconf is distributed in the hope that it will be useful, 

13# but WITHOUT ANY WARRANTY; without even the implied warranty of 

14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

15# GNU Lesser General Public License for more details. 

16# 

17# You should have received a copy of the GNU Lesser General Public License 

18# along with xdgpspconf. If not, see <https://www.gnu.org/licenses/>. 

19# 

20""" 

21Command line inputs 

22""" 

23 

24from argparse import ArgumentParser, RawDescriptionHelpFormatter 

25 

26from argcomplete import autocomplete 

27 

28 

29def _cli() -> ArgumentParser: 

30 """ 

31 Parser for autodoc 

32 """ 

33 parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter) 

34 # python bash/zsh completion 

35 parser.add_argument('-p', 

36 '--project', 

37 type=str, 

38 help='project whose configuration is sought') 

39 parser.add_argument('-c', 

40 '--custom', 

41 type=str, 

42 help='custom configuration location') 

43 parser.add_argument('-n', 

44 '--cname', 

45 type=str, 

46 default='config', 

47 help='''Name of config file [default: config] 

48 XDG_CONFIG_HOME/PROJECT/CNAME.(yml|toml|cfg)''') 

49 parser.add_argument('-a', 

50 '--ancestors', 

51 action='store_true', 

52 help='inherit ancestoral path configurations') 

53 autocomplete(parser) 

54 return parser 

55 

56 

57def cli() -> dict: 

58 """ 

59 Command line arguments 

60 """ 

61 parser = _cli() 

62 return vars(parser.parse_args())