dclint
Version:
A command-line tool for validating and enforcing best practices in Docker Compose files.
31 lines (30 loc) • 1.67 kB
TypeScript
import type { Document } from 'yaml';
/**
* Finds the line number where the key is located in the content.
* @param content The parsed YAML content as a string.
* @param key The key to search for in the content.
* @returns number The line number where the key is found, or 1 if not found.
*/
declare function findLineNumberByKey(content: string, key: string): number;
/**
* Finds the line number where the value is located in the content.
* @param content The parsed YAML content as a string.
* @param value The value to search for in the content.
* @returns number The line number where the key is found, or 1 if not found.
*/
declare function findLineNumberByValue(content: string, value: string): number;
/**
* Finds the line number where the service, key, or value is located in the YAML content.
* If the key is not provided, it returns the line number for the service block.
* If the key is provided without a value, it returns the line number for the key.
* If both key and value are provided, it searches for the specific key-value pair within the service.
*
* @param document
* @param content The parsed YAML content as a string.
* @param serviceName The name of the service to search for.
* @param key The optional key to search for in the service.
* @param value The optional value to search for within the key's content.
* @returns number The line number where the service, key, or value is found, or 1 if not found.
*/
declare function findLineNumberForService(document: Document, content: string, serviceName: string, key?: string, value?: string): number;
export { findLineNumberByKey, findLineNumberByValue, findLineNumberForService };