Esempio n. 1
0
    def __init__(self):
        GIT_CMDS = [
            "add", "gc", "receive-pack", "add--interactive", "get-tar-commit-id",
            "reflog", "am", "grep", "relink", "annotate", "gui", "remote", "apply",
            "gui--askpass", "remote-ext", "archimport", "gui--askyesno",
            "remote-fd", "archive", "gui.tcl", "remote-ftp", "bisect",
            "hash-object", "remote-ftps", "bisect--helper", "help", "remote-http",
            "blame", "http-backend", "remote-https", "branch", "http-fetch",
            "repack", "bundle", "http-push", "replace", "cat-file", "imap-send",
            "request-pull", "check-attr", "index-pack", "rerere", "check-ignore",
            "init", "reset", "check-mailmap", "init-db", "rev-list", "check-ref-format",
            "instaweb", "rev-parse", "checkout", "interpret-trailers", "revert",
            "checkout-index", "log", "rm", "cherry", "ls-files", "send-email",
            "cherry-pick", "ls-remote", "send-pack", "citool", "ls-tree",
            "sh-i18n--envsubst", "clean", "mailinfo", "shortlog", "clone",
            "mailsplit", "show", "column", "merge", "show-branch", "commit",
            "merge-base", "show-index", "commit-tree", "merge-file", "show-ref",
            "config", "merge-index", "stage", "count-objects", "merge-octopus",
            "stash", "credential", "merge-one-file", "status", "credential-store",
            "merge-ours", "stripspace", "credential-wincred", "merge-recursive",
            "submodule", "cvsexportcommit", "merge-resolve", "submodule--helper",
            "cvsimport", "merge-subtree", "subtree", "cvsserver", "merge-tree",
            "svn", "daemon", "mergetool", "symbolic-ref", "describe",
            "mktag", "tag", "diff", "mktree", "unpack-file", "diff-files",
            "mv", "unpack-objects", "diff-index", "name-rev", "update-index",
            "diff-tree", "notes", "update-ref", "difftool", "p4", "update-server-info",
            "difftool--helper", "pack-objects", "upload-archive", "fast-export",
            "pack-redundant", "upload-pack", "fast-import", "pack-refs", "var",
            "fetch", "patch-id", "verify-commit", "fetch-pack", "prune",
            "verify-pack", "filter-branch", "prune-packed", "verify-tag",
            "fmt-merge-msg", "pull", "web--browse", "for-each-ref", "push",
            "whatchanged", "format-patch", "quiltimport", "worktree",
            "fsck", "read-tree", "write-tree", "fsck-objects", "rebase",
        ]
        # get alias
        try:
            config = os.path.expanduser("~/.gitconfig")
            if os.path.exists(config):
                start = False
                for line in open(config):
                    if line.strip() == "[alias]":
                        start = True
                    elif line.startswith("["):
                        start = False
                    elif line.strip().startswith("#"):
                        pass
                    else:
                        if "=" in line:
                            GIT_CMDS.append(line.split("=")[0].strip())
        except OSError:
            pass

        GIT_CMDS.sort(cmp=lambda x, y: len(x) - len(y))
        WordCompleter.__init__(self, GIT_CMDS)
Esempio n. 2
0
 def __init__(self):
     SVN_CMDS = [
         "add", "auth", "blame", "praise", "annotate", "ann", "cat", "changelist",
         "cl", "checkout", "co", "cleanup", "commit", "ci", "copy", "cp",
         "delete", "del", "remove", "rm", "diff", "di", "export", "help",
         "?", "h", "import", "info", "list", "ls", "lock", "log", "merge",
         "mergeinfo", "mkdir", "move", "mv", "rename", "ren", "patch", "propdel",
         "pdel", "pd", "propedit", "pedit", "pe", "propget", "pget", "pg",
         "proplist", "plist", "pl", "propset", "pset", "ps", "relocate",
         "resolve", "resolved", "revert", "status", "stat", "st", "switch",
         "sw", "unlock", "update", "up", "upgrade",
     ]
     SVN_CMDS.sort(cmp=lambda x, y: len(x) - len(y))
     WordCompleter.__init__(self, SVN_CMDS)