Skip to content
Snippets Groups Projects
Select Git revision
  • d723b99e7b4e553bf8b5a883edff65a87a5ca858
  • master default protected
  • replication_test
  • release-1.10 protected
  • dev protected
  • 556-usage-statistics
  • 553-semantic-recommendation-2
  • 553-semantic-recommendation
  • release-1.9 protected
  • 551-init-broker-service-permissions
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • v1.10.4 protected
  • v1.10.3 protected
  • v1.10.2 protected
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
41 results

info.vue

Blame
  • command_line.py 2.17 KiB
    """ Command line interface of lifescale utils
    
    Copyright (C) 2022  Andreas Hellerschmied <heller182@gmx.at>
    """
    
    from lifescale.scripts.ls2csv import ls2csv as ls2csv_main
    import argparse
    import os
    
    
    def is_file(filename):
        """Check, whether the input string is the path to an existing file."""
        if os.path.isfile(filename):
            return filename
        raise argparse.ArgumentTypeError("'{}' is not a valid file.".format(filename))
    
    
    def is_dir(pathname):
        """Check, whether the input string is a valid and existing filepath."""
        if os.path.exists(pathname):
            return pathname
        raise argparse.ArgumentTypeError("'{}' is not a valid directory.".format(pathname))
    
    
    def ls2csv():
        """Command line interface including argument parser for the lifescale2csv converter."""
        parser = argparse.ArgumentParser(prog="ls2csv",
                                         description="Covnersion from lifescale xlsm output to csv files",
                                         epilog="The ls2csv converter loads and parses xslm files created by the lifescale "
                                                "unit. It writes several csv files to the output directory that contain "
                                                "extraced data from the input xlsm file in an easily readable way.",
                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
        parser.add_argument("-i", "--input-xlsm", type=is_file, required=True, help="Path and name of the input xlsm file created by "
                                                                     "lifescale.")
        parser.add_argument("-o", "--out-dir", type=is_dir, required=True, help="Output directory for the CSV files.")
        parser.add_argument("-nv", "--not-verbose", required=False, help="Disable command line status messages.",
                            action='store_true')
        # parser.add_argument("--out-dir", type=is_dir, required=False,
        #                     help="path to output directory", default=OUT_PATH)
        args = parser.parse_args()
        verbose = not args.not_verbose
    
        return ls2csv_main(xlsm_filename=args.input_xlsm, oputput_dir=args.out_dir, verbose=verbose)
    
    
    if __name__ == '__main__':
        ls2csv()