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

_p9k_taskwarrior_init_data:32: bad floating point constant #2648

Closed
igbanam opened this issue Apr 21, 2024 · 12 comments
Closed

_p9k_taskwarrior_init_data:32: bad floating point constant #2648

igbanam opened this issue Apr 21, 2024 · 12 comments

Comments

@igbanam
Copy link

igbanam commented Apr 21, 2024

I recently upgraded taskwarrior to 3.0.1 and I get this error

_p9k_taskwarrior_init_data:32: bad floating point constant

This looks similar to #1365.

Commenting out this line "fixes" it — i.e. allows me to get the prompt back — but I'm unsure if it's the right fix.

The output of the command string in "ts" is 3.0.1

$ task +PENDING -OVERDUE list rc.verbose=nothing rc.color=0 rc._forcecolor=0 rc.report.list.labels= rc.report.list.columns=due.epoch </dev/null 2>/dev/null
3.0.1

…thus…

$ ($(command task +PENDING -OVERDUE list rc.verbose=nothing rc.color=0 rc._forcecolor=0 rc.report.list.labels= rc.report.list.columns=due.epoch </dev/null 2>/dev/null))
zsh: command not found: 3.0.1

I think this is the error here? …but my zsh-fu is not even at beginner level

_p9k_taskwarrior_next_due=${${(on)ts}[1]}

@igbanam
Copy link
Author

igbanam commented Apr 21, 2024

…and I think I may have figured this one out. PR in a bit

igbanam added a commit to igbanam/powerlevel10k that referenced this issue Apr 21, 2024
After upgrading TaskWarrior to 3.0.1, I think... the comand means to
return some "Runnable" which resolves to a float, now returns the float
itself. So when we try to resolve the Runnable, ZSH throws an exception,
and p10k cannot parse the float from that. This just changes the
assumption that we get a float back.

p.s: Please when reviewing, ask youself "How does this affect P10K at
large?" I don't have this purview, but this change sure fixes my
problem.

Fixes romkatv#2648
@romkatv
Copy link
Owner

romkatv commented Apr 21, 2024

The output of "3.0.1" does not look like what we are trying to get. I suppose there was a backward-incompatible change in the command line API of task, so we now need to invoke a different command if the version of task is 3.x.

The PR you sent is on the wrong track, I'm afraid. I suggest that you disable taskwarrior prompt segment in your ~/.p10k.zsh and reverd the change you've made to powerlevel10k.

@igbanam
Copy link
Author

igbanam commented Apr 21, 2024

That's okay. I'll close the PR.

Yes, 3.x has some breaking changes in them.

Now, writing this comment, I'm realizing ts may have meant "timestamp" where p10k is trying to set the timestamp of the next due task, yes? If so, the command needs to be reworked. I sadly don't know much TaskWarrior to help with the command either.

I'll leave the issue open for someone who hopefully knows how to get that.

@igbanam
Copy link
Author

igbanam commented Apr 21, 2024

Also, how does one disable the task bit for p10k?

I searched and can't point to one shell variable I can turn off to disable this

@romkatv
Copy link
Owner

romkatv commented Apr 21, 2024

Also, how does one disable the task bit for p10k?

Open ~/.p10k.zsh and search for "timewarrior". You'll know what to do.

@romkatv
Copy link
Owner

romkatv commented Apr 21, 2024

I'm realizing ts may have meant "timestamp"

It's an array of pending tasks.

@cridemichel
Copy link

cridemichel commented Apr 21, 2024

Hi,
I do not know if this can help but after having had same issue, I started reusing my own segment function, i.e.

function prompt_mytaskwarrior() {
  emulate -L zsh
  setopt pipefail
  (( $+commands[task] ))          || return
  local line IFS
  task +PENDING count 2>/dev/null | read -r lineP || return
  task +OVERDUE count 2>/dev/null | read -r lineO || return
  [[ "${lineP}" == "0" ]] && return
  lineP="${lineP}"
  if [[ "${lineO}" == "0" ]]
  then
    lineO=""
  else
    lineO="!${lineO}"
  fi
  local tags="${lineP}${lineO}"
  [[ -n $tags ]] || return
  p10k segment -f 208 -i $'' -t $tags
}

and, although it is slow, it works flawlessly. To use it add this function to .zshrc before sourcing powerlevel10k and replace "taskwarrior" with" mytaskwarrior" in ".p10k.zsh"

best C.

@Bckempa
Copy link

Bckempa commented Apr 22, 2024

This is a regression in taskwarrior that will be fixed in a 3.0.2 patch release

@romkatv
Copy link
Owner

romkatv commented Apr 22, 2024

Thanks! That's great know.

@Bckempa
Copy link

Bckempa commented Apr 23, 2024

I no longer see this behavior after updating to Taskwarrior 3.0.2

@romkatv
Copy link
Owner

romkatv commented Apr 23, 2024

Thanks for the confirmation. Closing.

@romkatv romkatv closed this as completed Apr 23, 2024
@igbanam
Copy link
Author

igbanam commented Apr 23, 2024

Looks like the problem was with task. I can confirm this is fixed for me as well. Thanks @Bckempa!

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

Successfully merging a pull request may close this issue.

4 participants