From cc35972790040d8a7e8acb56cbff49de9b94be37 Mon Sep 17 00:00:00 2001 From: Ronit Jain Date: Tue, 22 Aug 2023 02:48:38 +0530 Subject: [PATCH] add alias for get command --- README.md | 17 ++++++++++++++++ lean/commands/object_store/__init__.py | 12 +---------- lean/commands/object_store/get.py | 6 +++--- lean/commands/object_store/object_store.py | 23 ++++++++++++++++++++++ 4 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 lean/commands/object_store/object_store.py diff --git a/README.md b/README.md index 26443cc0..3b402482 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ A locally-focused workflow (local development, local execution) with the CLI may - [`lean object-store delete`](#lean-object-store-delete) - [`lean object-store get`](#lean-object-store-get) - [`lean object-store list`](#lean-object-store-list) +- [`lean object-store ls`](#lean-object-store-ls) - [`lean object-store set`](#lean-object-store-set) - [`lean optimize`](#lean-optimize) - [`lean project-create`](#lean-project-create) @@ -1181,6 +1182,22 @@ Options: _See code: [lean/commands/object_store/list.py](lean/commands/object_store/list.py)_ +### `lean object-store ls` + +Alias for 'get' + +``` +Usage: lean object-store ls [OPTIONS] KEY + + Get a value from the organization's object store. + +Options: + --verbose Enable debug logging + --help Show this message and exit. +``` + +_See code: [lean/commands/object_store/ls.py](lean/commands/object_store/ls.py)_ + ### `lean object-store set` Sets the data to the given key in the organization's object store. diff --git a/lean/commands/object_store/__init__.py b/lean/commands/object_store/__init__.py index 9393a32a..d6108b87 100644 --- a/lean/commands/object_store/__init__.py +++ b/lean/commands/object_store/__init__.py @@ -11,22 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -from click import group - - +from lean.commands.object_store.object_store import object_store from lean.commands.object_store.get import get from lean.commands.object_store.set import set from lean.commands.object_store.list import list from lean.commands.object_store.delete import delete -@group() -def object_store() -> None: - """Interact with the Organization's Object Store.""" - # This method is intentionally empty - # It is used as the command group for all `lean object-store ` commands - pass - - object_store.add_command(get) object_store.add_command(set) object_store.add_command(list) diff --git a/lean/commands/object_store/get.py b/lean/commands/object_store/get.py index 082b22f4..5a1fce58 100644 --- a/lean/commands/object_store/get.py +++ b/lean/commands/object_store/get.py @@ -11,13 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -from click import command, argument - +from click import argument +from lean.commands.object_store import object_store from lean.click import LeanCommand from lean.container import container -@command(cls=LeanCommand) +@object_store.command(cls=LeanCommand, name="get", aliases=["ls"]) @argument("key", type=str) def get(key: str) -> str: """ diff --git a/lean/commands/object_store/object_store.py b/lean/commands/object_store/object_store.py new file mode 100644 index 00000000..8c0128ce --- /dev/null +++ b/lean/commands/object_store/object_store.py @@ -0,0 +1,23 @@ +# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. +# Lean CLI v1.0. Copyright 2021 QuantConnect Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from click import group +from lean.components.util.click_aliased_command_group import AliasedCommandGroup + +@group(cls=AliasedCommandGroup, invoke_without_command=True) +def object_store() -> None: + """Interact with the Organization's Object Store.""" + # This method is intentionally empty + # It is used as the command group for all `lean object-store ` commands + pass +