Skip to content
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

Move key tree #116

Closed
dsmalko opened this issue Dec 24, 2014 · 6 comments
Closed

Move key tree #116

dsmalko opened this issue Dec 24, 2014 · 6 comments
Milestone

Comments

@dsmalko
Copy link

dsmalko commented Dec 24, 2014

Is there a way to move key trees in multiple locales? Like change en.posts -> en.articles

@glebm
Copy link
Owner

glebm commented Dec 25, 2014

You can rename a key, e.g.:

i18n-tasks data en -fyaml | i18n-tasks tree-rename-key :.posts articles | i18n-tasks data-merge

@dsmalko
Copy link
Author

dsmalko commented Dec 25, 2014

Thanks.

@dsmalko dsmalko closed this as completed Dec 25, 2014
@dsmalko
Copy link
Author

dsmalko commented Jan 5, 2015

What if I want to move en.company.posts -> en.admin.posts?

@dsmalko dsmalko reopened this Jan 5, 2015
@glebm
Copy link
Owner

glebm commented Jan 8, 2015

@dsmalko That would be a feature i18n-tasks doesn't support yet. I would accept a PR adding a tree-mv-key (or something) task.

piisalie added a commit to piisalie/i18n-tasks that referenced this issue Jan 31, 2015
This adds the ability to move a node/leaf to a different position in the
tree. It duplicates some of the functionality of rename tool but
supports additional features such as moving a key 'up'/'down' the tree as
well as moving an entire node/sub-tree.

Example Usage:
--------------

given: en.yml
```
en:
  date:
    abbr_day_names:
    - Sun
    - Mon
```

If we run `i18n-tasks data en -fyaml | i18n-tasks tree-mv-key :.date
day_names > example.yml` the resulting structure will be

```
en:
  date_day_names:
    abbr_day_names:
    - Sun
    - Mon
```

Alternatively `i18n-tasks data en -yaml | i18n-tasks tree-mv-key
:.date.abbr_day_names day_names` will yield

```
en:
  day_names:
  - Sun
  - Mon
```
@glebm
Copy link
Owner

glebm commented Oct 28, 2015

My thoughts on what this should look like (from a comment in #126).

Move / rename / merge keys

i18n-tasks mv <pattern> <key> is a versatile task to merge-move nodes.
All nodes (leafs or subtrees) matching <pattern> are merged together and
merge-moved to <key>.

Rename a node (leaf or subtree):

$ i18n-tasks mv user account

Move a node:

$ i18n-tasks mv user_alerts user.alerts

Move the children one level up:

$ i18n-tasks mv 'alerts.{:}' '\1'

Merge-move multiple nodes:

$ i18n-tasks mv '{user,profile}' account

Merge nodes into parent:

$ i18n-tasks mv 'pages.{a,b}' pages

glebm added a commit that referenced this issue Dec 27, 2016
Move keys easily from the command line!

Fixes #116
glebm added a commit that referenced this issue Dec 27, 2016
Move keys easily from the command line!

Fixes #116
@glebm glebm added this to the v0.9.8 milestone Dec 27, 2016
glebm added a commit that referenced this issue Dec 27, 2016
Move keys easily from the command line!

Fixes #116
glebm added a commit that referenced this issue Dec 27, 2016
* New tasks: `mv`, `rm`, and `tree-mv`

Move keys easily from the command line!

Fixes #116

* Deprecate tree-rename-key
@glebm
Copy link
Owner

glebm commented Dec 27, 2016

Released in v0.9.8! 🎅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants