mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Rename "package" command to "pkg"
This commit is contained in:
@ -77,4 +77,10 @@ class PlatformioCLI(click.MultiCommand):
|
|||||||
from platformio.commands.project import project_init
|
from platformio.commands.project import project_init
|
||||||
|
|
||||||
return project_init
|
return project_init
|
||||||
|
|
||||||
|
if name == "package":
|
||||||
|
from platformio.commands.pkg import cli
|
||||||
|
|
||||||
|
return cli
|
||||||
|
|
||||||
raise AttributeError()
|
raise AttributeError()
|
||||||
|
@ -12,9 +12,21 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# pylint: disable=unused-import
|
import click
|
||||||
|
|
||||||
import platformio.package.commands.pack
|
from platformio.package.commands.pack import package_pack_cmd
|
||||||
import platformio.package.commands.publish
|
from platformio.package.commands.publish import package_publish_cmd
|
||||||
import platformio.package.commands.unpublish
|
from platformio.package.commands.unpublish import package_unpublish_cmd
|
||||||
from platformio.package.commands import cli
|
|
||||||
|
|
||||||
|
@click.group(
|
||||||
|
"pkg",
|
||||||
|
commands=[
|
||||||
|
package_pack_cmd,
|
||||||
|
package_publish_cmd,
|
||||||
|
package_unpublish_cmd,
|
||||||
|
],
|
||||||
|
short_help="Package Manager",
|
||||||
|
)
|
||||||
|
def cli():
|
||||||
|
pass
|
@ -11,10 +11,3 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import click
|
|
||||||
|
|
||||||
|
|
||||||
@click.group("package", short_help="Package manager")
|
|
||||||
def cli():
|
|
||||||
pass
|
|
||||||
|
@ -16,13 +16,12 @@ import os
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from platformio.package.commands import cli
|
|
||||||
from platformio.package.manifest.parser import ManifestParserFactory
|
from platformio.package.manifest.parser import ManifestParserFactory
|
||||||
from platformio.package.manifest.schema import ManifestSchema, ManifestValidationError
|
from platformio.package.manifest.schema import ManifestSchema, ManifestValidationError
|
||||||
from platformio.package.pack import PackagePacker
|
from platformio.package.pack import PackagePacker
|
||||||
|
|
||||||
|
|
||||||
@cli.command("pack", short_help="Create a tarball from a package")
|
@click.command("pack", short_help="Create a tarball from a package")
|
||||||
@click.argument(
|
@click.argument(
|
||||||
"package",
|
"package",
|
||||||
required=True,
|
required=True,
|
||||||
@ -32,7 +31,7 @@ from platformio.package.pack import PackagePacker
|
|||||||
@click.option(
|
@click.option(
|
||||||
"-o", "--output", help="A destination path (folder or a full path to file)"
|
"-o", "--output", help="A destination path (folder or a full path to file)"
|
||||||
)
|
)
|
||||||
def package_pack(package, output):
|
def package_pack_cmd(package, output):
|
||||||
p = PackagePacker(package)
|
p = PackagePacker(package)
|
||||||
archive_path = p.pack(output)
|
archive_path = p.pack(output)
|
||||||
# validate manifest
|
# validate manifest
|
||||||
|
@ -23,7 +23,6 @@ from platformio import fs
|
|||||||
from platformio.clients.account import AccountClient
|
from platformio.clients.account import AccountClient
|
||||||
from platformio.clients.registry import RegistryClient
|
from platformio.clients.registry import RegistryClient
|
||||||
from platformio.exception import UserSideException
|
from platformio.exception import UserSideException
|
||||||
from platformio.package.commands import cli
|
|
||||||
from platformio.package.manifest.parser import ManifestParserFactory
|
from platformio.package.manifest.parser import ManifestParserFactory
|
||||||
from platformio.package.manifest.schema import ManifestSchema
|
from platformio.package.manifest.schema import ManifestSchema
|
||||||
from platformio.package.meta import PackageType
|
from platformio.package.meta import PackageType
|
||||||
@ -41,7 +40,7 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
@cli.command("publish", short_help="Publish a package to the registry")
|
@click.command("publish", short_help="Publish a package to the registry")
|
||||||
@click.argument(
|
@click.argument(
|
||||||
"package",
|
"package",
|
||||||
required=True,
|
required=True,
|
||||||
@ -69,7 +68,7 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
|
|||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Do not show interactive prompt",
|
help="Do not show interactive prompt",
|
||||||
)
|
)
|
||||||
def package_publish( # pylint: disable=too-many-arguments, too-many-locals
|
def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals
|
||||||
package, owner, released_at, private, notify, non_interactive
|
package, owner, released_at, private, notify, non_interactive
|
||||||
):
|
):
|
||||||
click.secho("Preparing a package...", fg="cyan")
|
click.secho("Preparing a package...", fg="cyan")
|
||||||
|
@ -16,11 +16,10 @@ import click
|
|||||||
|
|
||||||
from platformio.clients.account import AccountClient
|
from platformio.clients.account import AccountClient
|
||||||
from platformio.clients.registry import RegistryClient
|
from platformio.clients.registry import RegistryClient
|
||||||
from platformio.package.commands import cli
|
|
||||||
from platformio.package.meta import PackageSpec, PackageType
|
from platformio.package.meta import PackageSpec, PackageType
|
||||||
|
|
||||||
|
|
||||||
@cli.command("unpublish", short_help="Remove a pushed package from the registry")
|
@click.command("unpublish", short_help="Remove a pushed package from the registry")
|
||||||
@click.argument(
|
@click.argument(
|
||||||
"package", required=True, metavar="[<organization>/]<pkgname>[@<version>]"
|
"package", required=True, metavar="[<organization>/]<pkgname>[@<version>]"
|
||||||
)
|
)
|
||||||
@ -35,7 +34,7 @@ from platformio.package.meta import PackageSpec, PackageType
|
|||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Undo a remove, putting a version back into the registry",
|
help="Undo a remove, putting a version back into the registry",
|
||||||
)
|
)
|
||||||
def package_unpublish(package, type, undo): # pylint: disable=redefined-builtin
|
def package_unpublish_cmd(package, type, undo): # pylint: disable=redefined-builtin
|
||||||
spec = PackageSpec(package)
|
spec = PackageSpec(package)
|
||||||
response = RegistryClient().unpublish_package(
|
response = RegistryClient().unpublish_package(
|
||||||
owner=spec.owner or AccountClient().get_logged_username(),
|
owner=spec.owner or AccountClient().get_logged_username(),
|
||||||
|
Reference in New Issue
Block a user