Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

rename: newly created key not renamed #485

Closed
markus2330 opened this issue Feb 10, 2016 · 9 comments
Closed

rename: newly created key not renamed #485

markus2330 opened this issue Feb 10, 2016 · 9 comments
Assignees
Labels
Milestone

Comments

@markus2330
Copy link
Contributor

@tom-wa When I mount using rename tolower=0, e.g. kdb mount .../machinekit.ini system/machinekit/cnc ini array= type rename tolower=0 then new keys are written out lowercase and are not converted to uppercase.

@markus2330 markus2330 added this to the 0.8.15 milestone Feb 10, 2016
@tom-wa
Copy link
Contributor

tom-wa commented Feb 10, 2016

thats the expected behaviour using tolower=0 (all keys below the parent key are converted to lowercase)

@markus2330
Copy link
Contributor Author

It also does not work with toupper. New mixed key always stay the same. I thought tolower is needed when you want lowercase Elektra names and uppercase persistent configuration? (Documentation should made that more clear, anyway.)

Another bug is that you cannot create new keys when the configuration file does not exist (empty keyset?).

The only thing that works nicely is that on the user side (with kdb, not in the configuration file) you see everything upper/lower as requested.

This should be reflected in the docu.

@tom-wa
Copy link
Contributor

tom-wa commented Feb 10, 2016

Oh, now i get what you meant, sorry.
the changes only apply to the keyset, the keys are written back with their original name (like the original rename plugin has did).
Do you want a different behaviour ?

@markus2330
Copy link
Contributor Author

No, lets rather concentrate on real bugs. Lets only update the docu.

Where a behavioural change might be useful is to have ranges, e.g. tolower=1..3 or negative numbers if counted from right. The counting from left and right in its current form is neither intuitive and is nor sufficient in many scenarios. But that is also something for later. (Let us put this to a limitations section in the plugin's docu).

@markus2330 markus2330 changed the title rename: newly created key rename: newly created key not documented properly Feb 10, 2016
@markus2330 markus2330 changed the title rename: newly created key not documented properly rename: newly created key not renamed Feb 16, 2016
@markus2330 markus2330 mentioned this issue Feb 16, 2016
10 tasks
@markus2330
Copy link
Contributor Author

To clarify: I think we also need a two-way renaming for machinekit. So every key the users get should be lowercase, everything passed to the storage uppercase (and vice-verca). It is a different feature, because it loses all case-preserving for the storage. Maybe we can cleverly have two different features that can be combined in every way: One feature that is about how the user sees the keys, the other feature how the storage will get the key? Then the user can combine (or even leave out) the features as desired.

@markus2330 markus2330 reopened this Feb 18, 2016
@markus2330 markus2330 modified the milestones: 0.8.16, 0.8.15 Apr 6, 2016
@markus2330
Copy link
Contributor Author

As discussed we need to handle both sides: get-side which produces Elektra (KeySet) and the set-side which writes to the configuration file.

Thus we need two different "tolower" and "toupper" to configure each possibility.

I would suggest:

get/case = lower|upper|title|unchanged
set/case = lower|upper|title|unchanged

Where unchanged is the default. |title| does not need to be implemented now, it is only for the sake of an argument why we should use an enum and not a flag.

@Strahlex is this ok for you or do you want a convenience/backward compatibility options tolower and toupper which set lower, upper for both directions?

@tom-wa
Copy link
Contributor

tom-wa commented Apr 13, 2016

@markus2330
an option to write the new/transformed/whatever keyname from the keyset (the one created by rename applying cut/replace/toupper/tolower) back would be nice too.

so set/case = lower | upper | newname | unchanged ?

@markus2330
Copy link
Contributor Author

Yes, there are plenty of other ways how to rename. But I am not sure what you are proposing here. Please elaborate or give an example what this new option should do. (But in a new issue please.) I think the lower|upper|unchanged are the most common ones.

@markus2330
Copy link
Contributor Author

markus2330 commented Apr 26, 2016

Works now flawless as expected:

$ kdb mount caseconversion.ini /rename ini rename get/case=tolower,set/case=toupper
$ kdb set user/rename/section/key valu
$ cat ~/.config/caseconversion.ini
[SECTION]
KEY = value

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

No branches or pull requests

2 participants