Deleting All JSON/Resetting TickTick

16 views
Skip to first unread message

Luke Davis

unread,
May 14, 2020, 2:54:27 AM5/14/20
to ticktick...@googlegroups.com
I would like a way to delete all the existing JSON, without having to know what
it is. In other words: I tickParse a bunch of stuff, use some of it, then want
to clear the deck and start over.

Is there anything unsafe, or causing quiet problems, with this function I've
written for the purpose?

# Unsets all the __tick_data_* variables
tickReset() {
for var in `set | sed -nr 's/^(__tick_data_[^=]+).*/\1/p'`
do unset "$var"
done
}

Chris McKenzie

unread,
May 18, 2020, 1:18:42 AM5/18/20
to ticktick...@googlegroups.com
That should be fine. there's probably less wild ways of doing this.
maybe some bash scoping trick would be useful ... I'll have to think
about it.

Luke Davis

unread,
May 18, 2020, 11:00:04 AM5/18/20
to ticktick...@googlegroups.com
Okay. I remember I tried a few different approaches, but that was the only one
that seemed to work.

If we didn't have to use sed it would be nice, but I haven't noticed a
performance penalty yet, since it is not a function that is called frequently.

I'm not sure what scoping tricks might work here, but I'll be very
interested in alternative approaches.

Otherwise, I submitted a PR for this one last week, if you decide it is
acceptable enough.

Luke

Chris McKenzie

unread,
May 18, 2020, 6:53:30 PM5/18/20
to ticktick...@googlegroups.com
oh I'm not sure about integrating that ... I'd have to try other methods
first. There has to be a better way then just blindly doing the
equivalent of 'rm -fr *' on the scope

Chris McKenzie

unread,
May 19, 2020, 7:18:31 PM5/19/20
to ticktick...@googlegroups.com
ok I thought about it more. I am trying to be a good FOSS leader so I'll
pull your solution in and if there's issues or a better version comes
along we can "upgrade" it later. I'll do that today sometime. Thanks for
your contribution, I appreciate it.

On 5/18/20 8:00 AM, Luke Davis wrote:
Reply all
Reply to author
Forward
0 new messages