Closed sergiorgiraldo closed 1 year ago
Thank you, I'll check this later.
Sorry for the late response.
I think the new file/directory's name should not be randomized even if 'untitled' exists: Users should know what the new item's name is.
Of course we must avoid the name conflict, so at least the new name should have the suffix based on a certain rule like _1
, _2
, etc, which is the same as yanking item(s). See fn put_items
in state.rs
for instance, though the process is a little bit complicated even for me who wrote this :(
Also, this may be a stupid question but, what is the use case of these commands? :touch <file name>
or :mkdir <dir name>
would be ok for me, which allows me to set the name as I want.
Thanks for the feedback.
I use this a lot to scrap temp notes and I know this can be deleted after a while. This is quicker than touch because I dont care about the name, it is a placeholder. Also this is the reason that I randomize the name; however I agree you are right that having a rule for it is better. I will see to change the naming rule.
On Wed, Jan 25, 2023 at 2:29 AM Kyohei Uto @.***> wrote:
Sorry for the late response.
I think the new file/directory's name should not be randomized even if 'untitled' exists: Users should know what the new item's name is. Of course we must avoid the name conflict, so at least the new name should have the suffix based on a certain rule like _1, _2, etc, which is the same as yanking item(s). See fn put_items in state.rs for instance, though the process is a little bit complicated even for me who wrote this :(
Also, this may be a stupid question but, what is the use case of these commands? :touch
would be ok for me, which allows me set the name as I want. — Reply to this email directly, view it on GitHub https://github.com/kyoheiu/felix/pull/168#issuecomment-1402922294, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIXMLFUNN4LQX5WU4MUL3LWUB6ZNANCNFSM6AAAAAATNT4N5E . You are receiving this because you authored the thread.Message ID: @.***>
Hm, that makes sense, and if you use these new features in that way, you definitely won't need the name convention. On the other hand, it'd be better to not add a new crate to minimize the cost to maintain. I'll think about this.
Edit: If we need a new crate, fastrand
https://github.com/smol-rs/fastrand would be better because of its dependency count.
Edit2: By using std::collections::hash_map::RandomState
we can make random numbers. This seems the simplest way for now.
cf. https://blog.orhun.dev/zero-deps-random-in-rust/
Edit3: Or just using nanoseconds and converting it to Base32 or something may be sufficient.
How do you think?
Changed the suffix method to 5 chars (BASE32) and removed rand
.
It'd be great if you check it.
Hello @sergiorgiraldo ,
Just wanted to inform you that I've merged this PR into main branch. Thank you again!
You can press "a" (add) followed by "f" -> create file or followed by "d" -> create directory