-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a debug CLI command #97
Closed
Closed
Conversation
This file contains 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
benji07
approved these changes
May 28, 2021
Tom32i
approved these changes
Jun 1, 2021
ogizanagi
added a commit
that referenced
this pull request
Jun 2, 2021
This PR was squashed before being merged into the 0.x-dev branch. Discussion ---------- Add a debug CLI command Introduce a new `debug:stenope:content` that'll be useful in multiple ways, to debug, list, filter and inspect contents managed by Stenope: ## List ```bash bin/console debug:stenope:content "App\Model\Page" ``` ![Capture d’écran 2021-05-28 à 16 40 01](https://user-images.githubusercontent.com/2211145/120000690-5fba9480-bfd3-11eb-957a-db473f718fd6.png) ## Show ```bash bin/console debug:stenope:content "App\Model\Index" README ``` ![Capture d’écran 2021-05-28 à 16 37 51](https://user-images.githubusercontent.com/2211145/120000413-110cfa80-bfd3-11eb-83dc-67e0d7298359.png) (change verbosity to display more) ## Order & Filter ```bash bin/console debug:stenope:content "App\Model\Article" \ --filter="not:outdated" \ --filter="slug contains:rebranding" \ --order="desc:date" ``` ![Capture d’écran 2021-05-28 à 16 37 03](https://user-images.githubusercontent.com/2211145/120000280-f33f9580-bfd2-11eb-9ef2-1c70fe6c91d3.png) --- There are some minor improvments / changes included in this PR as well: - handle fragment (anchors) when linking content between them ([see how we reference another document with an anchor](https://github.com/StenopePHP/Stenope/pull/97/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R58) in the documentation changes in this PR) - added the ability to provide a filter function for a specific property (it allows the `--filter=field contains:text` feature exposed in the command) - added the `TableOfContent` class. Small BC break (change your typehints from `Headline[]` to `TableOfContent`), but it allows to dump a simpler representation of the TOC when inspecting a content in non-verbose mode. It may also be useful later in case we need to introduce more data/config inside the TOC. - `ContentManager::getContents` now returns the slugs as keys ### TODO - [x] Add some functional tests for the debug command - [x] Add unit & functional tests for resolving links with anchors - [x] Add unit tests for filtering with a callable for a specific property - [x] Add tests to reflect the keys for `ContentManager::getContents` - Later: interactively ask the class if not provided - Later: allow partial classname if no conflict and ask between matches otherwise - Later: dedicated & more powerful parser classes for orders & filters Commits ------- 0279673 Add a debug CLI command
Merged in 0a01b1b |
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.
Introduce a new
debug:stenope:content
that'll be useful in multiple ways, to debug, list, filter and inspect contents managed by Stenope:List
bin/console debug:stenope:content "App\Model\Page"
Show
bin/console debug:stenope:content "App\Model\Index" README
(change verbosity to display more)
Order & Filter
There are some minor improvments / changes included in this PR as well:
--filter=field contains:text
feature exposed in the command)TableOfContent
class. Small BC break (change your typehints fromHeadline[]
toTableOfContent
), but it allows to dump a simpler representation of the TOC when inspecting a content in non-verbose mode. It may also be useful later in case we need to introduce more data/config inside the TOC.ContentManager::getContents
now returns the slugs as keysTODO
ContentManager::getContents