Skip to content

Commit

Permalink
base: add get-pkg-source command
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectrodeYT committed Nov 19, 2023
1 parent 8d806b3 commit b6eef4e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions xbstrap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,31 @@ def do_execute_manifest(args):
execute_manifest_parser.add_argument("-c", type=str)
execute_manifest_parser.set_defaults(_impl=do_execute_manifest)

# ----------------------------------------------------------------------------------------


def do_get_pkg_source(args):
cfg = config_for_args(args)
pkg = cfg.get_target_pkg(args.package)

if not pkg:
sys.exit(1)

src = cfg.get_source(pkg.source)
src_type = vcs_utils.vcs_name(src)

if src_type is None:
sys.exit(2)

print(src._this_yml[src_type])


get_pkg_source_parser = main_subparsers.add_parser("get-pkg-source")
get_pkg_source_parser.add_argument(
"package", type=str, help="xbstrap package to get the source URL for, if available"
)
get_pkg_source_parser.set_defaults(_impl=do_get_pkg_source)


def main():
args = main_parser.parse_args()
Expand Down

0 comments on commit b6eef4e

Please sign in to comment.