Update command args and readme
This commit is contained in:
parent
e45dc59d1f
commit
d950f0c521
16
README.md
16
README.md
@ -17,13 +17,25 @@ Unhacs provides several commands to manage your Home Assistant packages:
|
|||||||
To add a package, use the `add` command followed by the URL of the package. Optionally, you can specify the package name and version:
|
To add a package, use the `add` command followed by the URL of the package. Optionally, you can specify the package name and version:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
unhacs add --url <package_url> --name <package_name> --version <version>
|
unhacs add <package_url> --version <version>
|
||||||
```
|
```
|
||||||
|
|
||||||
If the package already exists, you can update it by adding the `--update` flag:
|
If the package already exists, you can update it by adding the `--update` flag:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
unhacs add --url <package_url> --update
|
unhacs add <package_url> --update
|
||||||
|
```
|
||||||
|
|
||||||
|
If the package is a Lovelace plugin, you must specify it using the `--plugin` flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
unhacs add --plugin <package_url>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you already have a list of packages in a file, you can add them all at once using the `--file` flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
unhacs add --file <file_path>
|
||||||
```
|
```
|
||||||
|
|
||||||
### List packages
|
### List packages
|
||||||
|
@ -32,20 +32,33 @@ def create_parser():
|
|||||||
|
|
||||||
subparsers = parser.add_subparsers(dest="subcommand", required=True)
|
subparsers = parser.add_subparsers(dest="subcommand", required=True)
|
||||||
|
|
||||||
|
# List installed packages
|
||||||
list_parser = subparsers.add_parser("list", description="List installed packages.")
|
list_parser = subparsers.add_parser("list", description="List installed packages.")
|
||||||
list_parser.add_argument("--verbose", "-v", action="store_true")
|
list_parser.add_argument("--verbose", "-v", action="store_true")
|
||||||
|
|
||||||
|
# Add packages
|
||||||
add_parser = subparsers.add_parser("add", description="Add or install packages.")
|
add_parser = subparsers.add_parser("add", description="Add or install packages.")
|
||||||
add_parser.add_argument(
|
|
||||||
|
package_group = add_parser.add_mutually_exclusive_group(required=True)
|
||||||
|
package_group.add_argument(
|
||||||
"--file", "-f", type=Path, help="The path to a package file."
|
"--file", "-f", type=Path, help="The path to a package file."
|
||||||
)
|
)
|
||||||
add_parser.add_argument(
|
package_group.add_argument(
|
||||||
"--type",
|
"url", nargs="?", type=str, help="The URL of the package."
|
||||||
"-t",
|
|
||||||
type=PackageType,
|
|
||||||
help="The type of the package. Defaults to 'integration'.",
|
|
||||||
)
|
)
|
||||||
add_parser.add_argument("url", nargs="?", type=str, help="The URL of the package.")
|
|
||||||
|
package_type_group = add_parser.add_mutually_exclusive_group()
|
||||||
|
package_type_group.add_argument(
|
||||||
|
"--integration",
|
||||||
|
action="store_const",
|
||||||
|
dest="type",
|
||||||
|
const=PackageType.INTEGRATION,
|
||||||
|
default=PackageType.INTEGRATION,
|
||||||
|
)
|
||||||
|
package_type_group.add_argument(
|
||||||
|
"--plugin", action="store_const", dest="type", const=PackageType.PLUGIN
|
||||||
|
)
|
||||||
|
|
||||||
add_parser.add_argument(
|
add_parser.add_argument(
|
||||||
"--version", "-v", type=str, help="The version of the package."
|
"--version", "-v", type=str, help="The version of the package."
|
||||||
)
|
)
|
||||||
@ -56,11 +69,13 @@ def create_parser():
|
|||||||
help="Update the package if it already exists.",
|
help="Update the package if it already exists.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Remove packages
|
||||||
remove_parser = subparsers.add_parser(
|
remove_parser = subparsers.add_parser(
|
||||||
"remove", description="Remove installed packages."
|
"remove", description="Remove installed packages."
|
||||||
)
|
)
|
||||||
remove_parser.add_argument("packages", nargs="+")
|
remove_parser.add_argument("packages", nargs="+")
|
||||||
|
|
||||||
|
# Upgrade packages
|
||||||
update_parser = subparsers.add_parser(
|
update_parser = subparsers.add_parser(
|
||||||
"upgrade", description="Upgrade installed packages."
|
"upgrade", description="Upgrade installed packages."
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user