GitOps Config Search
Free to use extension – proprietary code. Redistribution, modification, or repackaging is not permitted. See LICENSE for details.
Description
GitOps Config Search is a Visual Studio Code extension that allows you to search within GitOps configuration files efficiently. It supports multiple formats including table, CSV, and JSON. The module is designed to search in JSON files generated in TinyDB format.
Features
- Search within GitOps Configs: Easily search through your GitOps configuration files.
- Multiple Output Formats: Supports table, CSV, and JSON formats for displaying search results.
- Link Generation: Automatically generates links for objects within the configuration files.
- Customizable Properties: Configure which properties to display in the search results.
- Workspace Integration: Seamlessly integrates with your VS Code workspace.
Usage
Open a .gitsearch
file in your workspace (usually in the searches folder).
Run the GitOps Search
command from the command palette or the editor title menu (there is a magnification icon in the upper left corner of the editor pane for faster access).
View the search results in a new editor group.
Change the search terms and save the file. Your search results will be automatically refreshed. No need to go to the menu again.
.gitsearch File Configuration
The .gitsearch
file allows you to configure the search behavior. Below are the possible options you can set:
!format
: Specifies the output format. Possible values are table
, csv
, and json
.
!properties_to_display
: A comma-separated list of properties to display in the search results.
!uselinks
: Enables or disables link generation. Possible values are true
or false
. Default is true.
!table_format
: Specifies the table format configuration. See description below.
Filtering for Object Properties
You can filter objects based on their properties by specifying key-value pairs in the .gitsearch
file. The key is the property name, and the value is the search term. Regular expressions are supported.
Matching Objects Based on Properties
Objects are matched based on the properties specified in the .gitsearch
file.
For example, if you specify name: my-service
, only objects with a name
property that matches my-service
will be included in the search results.
Only objects that match all specified properties will be included in the search results. You can temporarily disable a property match by adding #
in front of it.
Special Case: Ports Matching
For the ports
property, you can specify a port number, and the search will match objects with port ranges that include the specified port.
Tips for Using Regex
- Use the pipe
|
notation to match multiple values (e.g., value1|value2
).
- By default, partial matches are allowed. Use
^
and $
to enforce exact matches.
.*
is not needed at the beginning and the end of the search term for partial matches.
The !table_format
option allows you to customize the appearance of the table output. This configuration is directly passed to the table formatter. For detailed options, refer to the table module documentation.
Example .gitsearch File
!format: table
!properties_to_display: name, description, ports
!uselinks: true
!table_format: {"singleLine": true}
name: ^my-service$
description: service|application
ports: 8080
#disabled_property: value
Installation
- Install the extension from the Visual Studio Code Marketplace.
- Open your GitOps configuration repository in VS Code.
- Start using the
GitOps Search
command.
Commands
GitOps Search
: Executes the search based on the .gitsearch
file and displays the results.
Configuration
You can customize the search behavior by modifying the .gitsearch
files and the searches.json
configuration file in your workspace.
The searches.json
file in the searches folder contains type-specific configurations for your searches. Below is an example and explanation of each field:
{
"service": {
"database": "database/core/services/services.json",
"link": "core,services,{subsystem},{name}",
"path": "core,services",
"template": "\"{part}\": Service"
},
"application": {
"database": "database/core/applications/applications.json",
"link": "communication,applications,{name}",
"path": "communication,applications",
"template": "\"{part}\""
}
}
database
: The JSON file that contains the data for this type.
link
: The template for generating links for objects of this type. {name}
will be replaced with the object's name.
path
: The path within the workspace where the data files are located.
template
: The template used for resolving link targets.
License
Free-of-charge proprietary license (no redistribution or modification). See LICENSE
plus third‑party attributions in THIRD_PARTY_NOTICES
and licenses.json
.