Add filtering, paging, and richer output to all list commands - #9
Open
151N3 wants to merge 4 commits into
Open
Conversation
Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades all five
listcommands (cube, dimension, process, subset, view) with a consistent setof new options, fixes a code bug, hardens the test suite, and patches a crash in the
threadscommand.New features
Shared utility (
tm1cli/utils/list_utils.py)New module with
OutputFormat(yaml/json),VisibilityType(public/private/both),apply_filter,apply_paging, andrender_output— reused by all list commands.Common new options on
cube list,dimension list,process list--filter/-f--output/-oyaml(default) orjson--limit--offsetOutput format changed from one name per line to a YAML/JSON list (
- Name).subset listandview list— richer structured outputdimension_name/cube_namearguments replaced by optional--dimension/--cubeflags; omitting them iterates over all non-control dimensions/cubes.
--type/-tflag:public(default),private, orboth.dimension/cube,name, andtype.process list— skip control TIsNew
--skip-control-tis/-sflag to exclude processes whose names start with}.dimension listFlag renamed from
--skip-control-cubes→--skip-control-dims(was a copy-paste mistake).Bug fixes
process.py— duplicateAnnotatedimport removedfrom typing_extensions import Annotatedwas left in place after the newfrom typing import Annotated, Optionalwas added, silently shadowing it.The stale
typing_extensionsimport was removed.main.py—threads --beautifycrash on empty listthreads[0].keys()raisedIndexErrorwhen no threads were active for the current session.Added an empty-list guard; prints
"No threads."in that case.Test improvements
tests/conftest.pyMockedCubeService.get_all_namessignature fixed to match the real API (skip_control_cubeskwarg).MockedViewService.get_all_namesnow returns a(private, public)tuple matching TM1py's actual return type.MockedSubsetService.get_all_namesextended withhierarchy_nameandprivateparameters.MockedProcessServiceadded withget_all_names,exists,get, andupdate_or_create.New
tests/test_cmd_process.py8 mocked unit tests covering
list/lsaliases, JSON output (--output json),--filter,--limit,--offset, andexiststrue/false.tests/test_tm1cli.pytest_process_clone_not_existsconverted to a mocked test: patches bothTM1Serviceandresolve_databaseso the process-not-found path is reached before any database-lookup error.