Exemple #1
0
	def _parse_args(self):

		subcommands = ["pdf", "sign", "vycetka", "save", "mail", "ds", "ocr", "arg", "config", "version"]
		configs = list(self.configs.values())

		p = ByroParse(
			subcommands,
			default_config_files=configs,
			description=__doc__,
			epilog="Version: " + __version__ + ", Authors: " + str(__author__)
		)

		p.add('-c', '--config', is_config_file=True, help='config file path')
		p.add('-g', '--gui', type=bool, help="")
		p.add('-l', '--locale', help="Locale, for example: cs_CZ, en_US")
		p.add('-o', '--out', help="Output file name")
		# TODO: config path

		con = p.add_argument_group('Config', "Show config path and ends.")
		con.add('-a', '--add', help="Add argument into used config")

		vyc = p.add_argument_group('Vycetka', "Generates \"vycetka\" for Prague City Hall.")
		vyc.add('--url', help="Target Redmine url.")
		vyc.add('-p', '--project', help="Redmine project name.")
		vyc.add('-y', '--year',  help="Values: this, last, 2014, 2015, ...")
		vyc.add('-m', '--month', help="Values: this, last, leden, únor, ..., prosinec, 1, ..., 12. Determinate by localization.")
		vyc.add('-u', '--user',  help="Redmine user nickname or id.")

		sign = p.add_argument_group('Sign', "Digital sign of pdf file.")
		sign.add('-k', '--sign-key', help="Path to the key.pfx")
		sign.add('--sign-bin', help="Path to the jPdfSign")
		sign.add('-V', '--sign-visible', type=bool, help="")
		sign.add('--sign-reason', help="")
		sign.add('--sign-location', help="")
		sign.add('--sign-contact', help="")

		pdf = p.add_argument_group('Pdf', "Convert markdown into pdf via Pandoc.")
		pdf.add('--pandoc-bin', help="Path to pandoc binary.")
		pdf.add('--tex-bin', help="")
		pdf.add('-t', '--template', help="Path to XeLaTeX template.")
		# TODO
		pdf.add('-D', '--print-default-template', help="Print default template.")

		mail = p.add_argument_group('Mail', "Send mass mails, body is markdown file, list of recipients is file")
		mail.add("-r", "--recipients", help="Email, or path to text file with recipients divided by newline.")
		mail.add("-f", "--frm", help="Sender email address.")
		mail.add("--login", help="Email login")
		mail.add("--server", help="Email server")
		mail.add("--port", help="Port")

		ocr = p.add_argument_group("Ocr", "OCR images: byro -o <text>.txt file1.jpg file2.jpg")

		ds = p.add_argument_group('Ds')
		ds.add('--ds-id', help="")

		p.add_argument('inputs', metavar='input files', nargs='*', help='Input files')

		self.arg_parser = p
		self.args = p.parse_args(self.raw_argv)
Exemple #2
0
	def _parse_args(self):

		subcommands = ["pdf", "sign", "vycetka", "save", "mail", "ds", "ocr", "args"]

		p = ByroParse(
			subcommands,
			default_config_files=[self.default_config, self.user_confg],
			description=__doc__,
			epilog=str(__author__)
		)

		p.add('-c', '--config', is_config_file=True, help='config file path')
		p.add('-g', '--gui', type=bool, help="")
		p.add('-l', '--locale', help="")
		p.add('-o', '--out', help="Output file name")

		vyc = p.add_argument_group('Vycetka', "Generates \"vycetka\" for Prague City Hall.")
		vyc.add('--url', help="Target Redmine url.")
		vyc.add('-p', '--project', help="Redmine project name.")
		vyc.add('-y', '--year', help="Values: this, last, 2014, 2015, ...")
		vyc.add('-m', '--month',
		        help="Values: this, last, leden, únor, ..., prosinec, 1, ..., 12. Determinate by localization.")
		vyc.add('-u', '--user', help="Redmine user nickname or id.")

		sign = p.add_argument_group('Sign', "Digital sign of pdf file.")
		sign.add('-k', '--sign-key', help="Path to the key.pfx")
		sign.add('--sign-bin', help="Path to the jPdfSign")
		sign.add('-V', '--sign-visible', type=bool, help="")
		sign.add('--sign-reason', help="")
		sign.add('--sign-location', help="")
		sign.add('--sign-contact', help="")

		pdf = p.add_argument_group('Pdf', "Convert markdown into pdf via Pandoc.")
		pdf.add('--pandoc-bin', help="Path to pandoc binary.")
		pdf.add('--tex-bin', help="")
		pdf.add('-t', '--template', help="Path to XeLaTeX template.")

		mail = p.add_argument_group('Mail', "Send mass mails, body is markdown file, list of recipients is file")
		mail.add("-r", "--recipients", help="Email, or path to text file with recipients divided by newline.")
		mail.add("-f", "--frm", help="Sender email address.")
		mail.add("--login", help="Email login")
		mail.add("--server", help="Email server")
		mail.add("--port", help="Port")

		ds = p.add_argument_group('Ds')
		ds.add('--ds-id', help="")

		p.add_argument('inputs', metavar='input files', nargs='*', help='Input files')

		self.arg_parser = p
		self.args = p.parse_args()
Exemple #3
0
    def _parse_args(self):

        subcommands = [
            "pdf", "sign", "vycetka", "save", "mail", "ds", "ocr", "arg",
            "config", "version"
        ]
        configs = list(self.configs.values())

        p = ByroParse(subcommands,
                      default_config_files=configs,
                      description=__doc__,
                      epilog="Version: " + __version__ + ", Authors: " +
                      str(__author__))

        p.add('-c', '--config', is_config_file=True, help='config file path')
        p.add('-g', '--gui', type=bool, help="")
        p.add('-l', '--locale', help="Locale, for example: cs_CZ, en_US")
        p.add('-o', '--out', help="Output file name")
        # TODO: config path

        con = p.add_argument_group('Config', "Show config path and ends.")
        con.add('-a', '--add', help="Add argument into used config")

        vyc = p.add_argument_group(
            'Vycetka', "Generates \"vycetka\" for Prague City Hall.")
        vyc.add('--url', help="Target Redmine url.")
        vyc.add('-p', '--project', help="Redmine project name.")
        actual_year = datetime.date.today().year
        vyc.add('-y',
                '--year',
                default=actual_year,
                help="Values: this, last, 2014, 2015, ...")
        vyc.add(
            '-m',
            '--month',
            help=
            "Values: this, last, leden, únor, ..., prosinec, 1, ..., 12. Determinate by localization."
        )
        vyc.add('-u', '--user', help="Redmine user nickname or id.")

        sign = p.add_argument_group('Sign', "Digital sign of pdf file.")
        sign.add('-k', '--sign-key', help="Path to the key.pfx")
        sign.add('--sign-bin', help="Path to the jPdfSign")
        sign.add('-V', '--sign-visible', type=bool, help="")
        sign.add('--sign-reason', help="")
        sign.add('--sign-location', help="")
        sign.add('--sign-contact', help="")

        pdf = p.add_argument_group('Pdf',
                                   "Convert markdown into pdf via Pandoc.")
        pdf.add('--pandoc-bin', help="Path to pandoc binary.")
        pdf.add('--tex-bin', help="")
        pdf.add('-t', '--template', help="Path to XeLaTeX template.")
        # TODO
        pdf.add('-D',
                '--print-default-template',
                help="Print default template.")

        mail = p.add_argument_group(
            'Mail',
            "Send mass mails, body is markdown file, list of recipients is file"
        )
        mail.add(
            "-r",
            "--recipients",
            help=
            "Email, or path to text file with recipients divided by newline.")
        mail.add("-f", "--frm", help="Sender email address.")
        mail.add("--login", help="Email login")
        mail.add("--server", help="Email server")
        mail.add("--port", help="Port")

        ocr = p.add_argument_group(
            "Ocr", "OCR images: byro -o <text>.txt file1.jpg file2.jpg")

        ds = p.add_argument_group('Ds')
        ds.add('--ds-id', help="")

        p.add_argument('inputs',
                       metavar='input files',
                       nargs='*',
                       help='Input files')

        self.arg_parser = p
        self.args = p.parse_args(self.raw_argv)