{"id":15011024,"url":"https://github.com/psycofdj/yaml-path","last_synced_at":"2025-04-09T18:42:15.323Z","repository":{"id":57546546,"uuid":"142685904","full_name":"psycofdj/yaml-path","owner":"psycofdj","description":"Get \"xpath\" for a given line at column of a YAML file","archived":false,"fork":false,"pushed_at":"2018-12-24T07:14:25.000Z","size":982,"stargazers_count":17,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T20:43:34.435Z","etag":null,"topics":["bosh","emacs","golang","xpath","yaml"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psycofdj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-28T14:56:20.000Z","updated_at":"2024-02-14T07:56:30.000Z","dependencies_parsed_at":"2022-09-05T10:51:05.157Z","dependency_job_id":null,"html_url":"https://github.com/psycofdj/yaml-path","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psycofdj%2Fyaml-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psycofdj%2Fyaml-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psycofdj%2Fyaml-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psycofdj%2Fyaml-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psycofdj","download_url":"https://codeload.github.com/psycofdj/yaml-path/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248090159,"owners_count":21046035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bosh","emacs","golang","xpath","yaml"],"created_at":"2024-09-24T19:38:31.342Z","updated_at":"2025-04-09T18:42:15.300Z","avatar_url":"https://github.com/psycofdj.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --\u003e\n**Table of Contents**\n\n- [What](#what)\n- [Why ?](#why-)\n- [Usage](#usage)\n- [Example](#example)\n- [Integration](#integration)\n    - [Emacs](#emacs)\n    - [Vim](#vim)\n    - [Intellij](#intellij)\n- [Note](#note)\n\n\u003c!-- markdown-toc end --\u003e\n\n\n# What\n\n`yaml-path` reads given yaml on stdin and output a sort of 'path' corresponding to given `line` and\n`column` in the file.\n\nGenerated path is compilant with [BOSH](https://bosh.io/docs/cli-v2/) `ops-file` syntax.\n\n\n# Why ?\n\nWorking with [BOSH](https://bosh.io/docs/cli-v2/) often require to writes so-called `ops-file` which\nare kind of patches for yaml files. Writing the path of the object to modify is a real burden in large\nyaml files.\n\nThis tool is meant to be easily integrated in editor such as emacs.\n\n# Usage\n\n```\nusage: yaml-path [\u003cflags\u003e]\n\nFlags:\n  -h, --help         Show context-sensitive help (also try --help-long and --help-man).\n      --line=0       Cursor line\n      --col=0        Cursor column\n      --sep=\"/\"      Set path separator\n      --name=\"name\"  Set attribut name, empty to disable\n      --path=\"\"      Set filepath, empty means stdin\n      --version      Show application version.\n```\n\n# Example\n\nGiven the following yaml file:\n```yaml\ntop:\n  first:\n    - name: myname\n      attr1: val1\n      attr2: val2\n      #       ^\n    - value2\n    - value3\n  second:\n    child1: value1\n    child1: value2\n    child3: value3\n```\n\n`cat test.yaml | ./yaml-path --line 5 --col 14`\n\nOutputs:\n```\n/top/first/name=myname/attr2\n```\n\n# Integration\n## Emacs\n\nGet a local copy of this repo :\n```\ngit clone https://github.com/psycofdj/yaml-path.git\n```\n\nInstall emacs `yaml-path` package:\n```\ncd emacs \u0026\u0026 make install\n```\n\nProvided functions:\n\n- `yaml-path-at-point` : (interactive) display in minibuffer and store to kill ring yaml path for token under cursor\n- `yaml-path-get-path-at-point(\u0026optional line col)` : return yaml path for token in current buffer at given line and column\n- `yaml-path-which-func`: integrates `yaml-path-get-path-at-point` with [which-function-mode](https://www.emacswiki.org/emacs/WhichFuncMode)\n\nDemo:\n\n![Demo](./doc/demo-emacs.gif)\n\n## Vim\n\nInstall vim script (see the [README](./plugin/README.md)):\n```\ncat ./plugin/yaml-path.vim \u003e\u003e ~/.vimrc\n```\n\nDemo:\n\n![Demo](./doc/demo-vim.gif)\n\n\n## Intellij\n\n1. Go to preference -\u003e tools -\u003e external tools\n2. Add a new one with this configuration\n\n![Demo](./doc/config-intellij.png)\n\n\n# Note\n\nThe current implementation relies on a very savage hack of golang [yaml](https://github.com/go-yaml/yaml)\nlibrary vendored in this project.\n\n\u003c!-- Local Variables: --\u003e\n\u003c!-- End: --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsycofdj%2Fyaml-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsycofdj%2Fyaml-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsycofdj%2Fyaml-path/lists"}