<commit_before>import sys
import os
import argcomplete
import argparse
import dmake.commands as commands
import dmake.core as core
import dmake.common as common


def check_is_git_repo():
    try:
        common.run_shell_command('git rev-parse --abbrev-ref HEAD')
        return True
    except common.ShellError as e:
        common.logger.error("Current directory is not a Git repository:\n%s" % str(e))
        return False


def add_argument(parsers, *args, **kwargs):
    for parser in parsers:
        parser.add_argument(*args, **kwargs)


def completion_action(args):
    print(argcomplete.shellcode('dmake', shell=args.shell))


# Find root
try:
    root_dir, sub_dir = common.find_repo_root()
except common.ShellError as e:
    common.logger.error("Current directory is not a Git repository:\n%s" % str(e))
    sys.exit(1)
os.chdir(root_dir)

# Defines command line parser
argparser = argparse.ArgumentParser(prog='dmake')<commit_msg>Fix argcompletion shell code generation (#476)<commit_after>import sys
import os
import argcomplete
import argparse
import dmake.commands as commands
import dmake.core as core
import dmake.common as common


def check_is_git_repo():
    try:
        common.run_shell_command('git rev-parse --abbrev-ref HEAD')
        return True
    except common.ShellError as e:
        common.logger.error("Current directory is not a Git repository:\n%s" % str(e))
        return False


def add_argument(parsers, *args, **kwargs):
    for parser in parsers:
        parser.add_argument(*args, **kwargs)


def completion_action(args):
    print(argcomplete.shellcode(['dmake'], shell=args.shell))


# Find root
try:
    root_dir, sub_dir = common.find_repo_root()
except common.ShellError as e:
    common.logger.error("Current directory is not a Git repository:\n%s" % str(e))
    sys.exit(1)
os.chdir(root_dir)

# Defines command line parser
argparser = argparse.ArgumentParser(prog='dmake')
{'fraction_non_alphanumeric': 0.10337662337662337, 'fraction_numerical': 0.0025974025974025974, 'mean_word_length': 4.041884816753926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6107489', 'n_tokens_mistral': 609, 'n_tokens_neox': 587, 'n_words': 170}