Beispiel #1
0
def main():
    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--help',
                        '-help',
                        action='store_true')

    args = parser.parse_args()

    if args.help:
        cmd = sys.argv[0].partition(".")[0]
        help.display_help(cmd)
        return

    if os.path.isfile(config_file):
        print("The file config.ini already exists, do you want to continue and " +
              "over-write the file with new settings? (y/N)")

        action = input().upper()

        if action == "Y" or action == "YES":
            create_file()
        else:
            os.startfile(config_file, 'edit')  # Opens the file for editing
            sys.exit(0)
    else:
        create_file()
Beispiel #2
0
def main():
    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--help', '-help', action='store_true')

    args = parser.parse_args()

    if args.help:
        cmd = sys.argv[0].partition(".")[0]
        help.display_help(cmd)
        return

    execute()
def main():
    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--help',
                        '-help',
                        action='store_true')

    args = parser.parse_args()

    if args.help:
        cmd = sys.argv[0].partition(".")[0]
        help.display_help(cmd)
        return

    execute()
def main():
    parser = argparse.ArgumentParser(add_help=True, allow_abbrev=False)
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-d',
                       '--directory',
                       nargs=1,
                       metavar='DIR',
                       help='directory to manage files in')
    group.add_argument('-dh',
                       '--dhelp',
                       action='store_true',
                       help='displays detailed help for this hacker-script')

    args = parser.parse_args()

    if args.directory:
        execute(args.directory[0])
    elif args.dhelp:
        cmd = sys.argv[0].partition(".")[0]
        help.display_help(cmd)
        return
def main():
    parser = argparse.ArgumentParser(add_help=True, allow_abbrev=False)
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-a',
                       '--action',
                       choices=['add', 'del'],
                       help='add/del scheduled tasks')
    group.add_argument('-dh',
                       '--dhelp',
                       action='store_true',
                       help='displays detailed help for this hacker-script')
    args = parser.parse_args()

    if args.dhelp:
        cmd = sys.argv[0].partition(".")[0]
        help.display_help(cmd)
        return
    elif args.action == "add":
        add_task()
    else:
        del_task()
Beispiel #6
0
def main():
    parser = argparse.ArgumentParser(add_help=True, allow_abbrev=False)
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-d',
                       '--directory',
                       nargs=1,
                       metavar='DIR',
                       help='directory to manage files in')
    group.add_argument('-dh',
                       '--dhelp',
                       action='store_true',
                       help='displays detailed help for this hacker-script')

    args = parser.parse_args()

    if args.directory:
        execute(args.directory[0])
    elif args.dhelp:
        cmd = sys.argv[0].partition(".")[0]
        help.display_help(cmd)
        return
Beispiel #7
0
    def basic_main(self, execute_method):
        """
        A simple form of the main() function used by most of the hacker-scripts

        Parameters:
            execute_method:
                The method to execute after finishing with the main method.
                This method is executed only if any of the help arguments are not passed while
                executing a hacker-script.
        """
        parser = argparse.ArgumentParser(add_help=True)
        parser.add_argument(
            '-dhelp',
            '--dhelp',
            action='store_true',
            help='displays detailed help for this hacker-script')
        args = parser.parse_args()

        if args.dhelp:
            cmd = sys.argv[0].partition(".")[0]
            help.display_help(cmd)
            return

        execute_method()