~michel-slm/myrepos-utils

ref: c16517229e60aa05a5d1997e7ae534271c6f7006 myrepos-utils/myrepos_utils/cli.py -rw-r--r-- 656 bytes
c1651722Michel Alexandre Salim Initial commit 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# (c) Michel Alexandre Salim
#
# Fedora-License-Identifier: GPLv2+
# SPDX-2.0-License-Identifier: GPL-2.0+
# SPDX-3.0-License-Identifier: GPL-2.0-or-later
#
# This program is free software.
# For more information on the license, see COPYING.md.
# For more information on free software, see
# <https://www.gnu.org/philosophy/free-sw.en.html>.

import click
import json
import sys
from . import utils


@click.group()
def cli():
    pass


@cli.command(help="cd to a directory tracked by myrepos")
@click.argument("paths", nargs=-1)
def cd(paths: list[str]):
    import os

    os.chdir(utils.find_dir(paths))