コード例 #1
0
ファイル: git_ls.py プロジェクト: DrXyzzy/smc
def main():
    import argparse
    parser = argparse.ArgumentParser(
        description=
        "git-ls -- like ls, but git *aware*, and JSON output; files not under git are still included."
    )
    parser.add_argument(
        '--time',
        help='order by time instead of alphabetical order (default: False)',
        action='store_true')
    parser.add_argument('--start', help='starting file number', default=0)
    parser.add_argument(
        '--limit', help='maximum number of files', default=0)  # 0 = no limit
    parser.add_argument(
        '--git',
        help="actually be git aware (not the default)",
        action="store_true")
    parser.add_argument(
        '--hidden',
        help="include files/directories that start with a dot",
        action="store_true")
    parser.add_argument(
        '--directories_first',
        help="sort by putting directories first, then files (default: False)",
        action="store_true")
    parser.add_argument(
        'path',
        nargs='?',
        help='return info about all files in this path',
        default='.')
    args = parser.parse_args()
    if isinstance(args.path, list):
        args.path = args.path[0]

    if os.path.abspath(args.path) == os.path.join(os.environ['HOME'],
                                                  '.snapshots'):
        # When getting a listing for the .snapshots directory, update it to show the latest version.
        from update_snapshots import update_snapshots
        update_snapshots()

    r = gitls(
        path=args.path,
        time=args.time,
        start=int(args.start),
        limit=int(args.limit),
        hidden=args.hidden,
        directories_first=args.directories_first,
        git_aware=args.git)
    print json.dumps(r, separators=(',', ':'))
コード例 #2
0
ファイル: git_ls.py プロジェクト: pplonski/cocalc
def main():
    import argparse
    parser = argparse.ArgumentParser(
        description=
        "git-ls -- like ls, but git *aware*, and JSON output; files not under git are still included."
    )
    parser.add_argument(
        '--time',
        help='order by time instead of alphabetical order (default: False)',
        action='store_true')
    parser.add_argument('--start', help='starting file number', default=0)
    parser.add_argument(
        '--limit', help='maximum number of files', default=0)  # 0 = no limit
    parser.add_argument(
        '--git',
        help="actually be git aware (not the default)",
        action="store_true")
    parser.add_argument(
        '--hidden',
        help="include files/directories that start with a dot",
        action="store_true")
    parser.add_argument(
        '--directories_first',
        help="sort by putting directories first, then files (default: False)",
        action="store_true")
    parser.add_argument(
        'path',
        nargs='?',
        help='return info about all files in this path',
        default='.')
    args = parser.parse_args()
    if isinstance(args.path, list):
        args.path = args.path[0]

    if os.path.abspath(args.path) == os.path.join(os.environ['HOME'],
                                                  '.snapshots'):
        # When getting a listing for the .snapshots directory, update it to show the latest version.
        from update_snapshots import update_snapshots
        update_snapshots()

    r = gitls(
        path=args.path,
        time=args.time,
        start=int(args.start),
        limit=int(args.limit),
        hidden=args.hidden,
        directories_first=args.directories_first,
        git_aware=args.git)
    print(json.dumps(r, separators=(',', ':')))
コード例 #3
0
ファイル: start_smc.py プロジェクト: timothyclemansinsea/smc
def main():
    # Start local hub server
    cmd("smc-local-hub start")

    i=0
    while not started():
        time.sleep(0.1)
        i += 1
        print i,
        sys.stdout.flush()
        if i >= 100:
            sys.exit(1)

    # Update the ~/.snapshots path symlinks
    from update_snapshots import update_snapshots
    update_snapshots()
コード例 #4
0
ファイル: start_smc.py プロジェクト: NoriVicJr/smc
def main():
    create_root_link()

    # Start local hub server
    cmd("smc-local-hub start")

    i=0
    while not started():
        time.sleep(0.1)
        i += 1
        print i,
        sys.stdout.flush()
        if i >= 100:
            sys.exit(1)

    # Update the ~/.snapshots path symlinks
    from update_snapshots import update_snapshots
    update_snapshots()
コード例 #5
0
ファイル: start_smc.py プロジェクト: yenchiah/cocalc
def main():
    # concatenate all additional arguments and pass them to the node.js server
    port_args = ' '.join(sys.argv[2:])

    # Start local hub server
    cmd("smc-local-hub start " + port_args)

    i = 0
    while not started():
        time.sleep(0.1)
        i += 1
        print(i, end=" ")
        sys.stdout.flush()
        if i >= 100:
            sys.exit(1)

    # Update the ~/.snapshots path symlinks
    from update_snapshots import update_snapshots
    update_snapshots()
コード例 #6
0
ファイル: start_smc.py プロジェクト: DrXyzzy/smc
def main():
    # concatenate all additional arguments and pass them to the node.js server
    port_args = ' '.join(sys.argv[2:])

    # Start local hub server
    cmd("smc-local-hub start " + port_args)

    i = 0
    while not started():
        time.sleep(0.1)
        i += 1
        print i,
        sys.stdout.flush()
        if i >= 100:
            sys.exit(1)

    # Update the ~/.snapshots path symlinks
    from update_snapshots import update_snapshots
    update_snapshots()