jschlatow / taskopen

Tool for taking notes and open urls with taskwarrior
GNU General Public License v2.0
363 stars 31 forks source link

config not found #150

Closed jaker-dotcom closed 2 years ago

jaker-dotcom commented 2 years ago

Taskopen does not open the previously created notes anymore. Instead it reads:

No actions applicable.
Attaching to task 214 'garmin smartwatch kaufen'.
Type a file extension (or none):

I think it is due to the program not finding the config file and thus not the notes folder and not knowing the NOTES_REGEX. The taskopenrc is located at /home/user/.config/taskopen/taskopenrc, as specified in man taskopenrc. Even specifying the file via taskopen -c /home/user/.config/taskopen/taskopenrc does not solve the problem. It yields Config file '' does not exist, create it? [y/N]: even though the file exists!

Any idea?

jaker-dotcom commented 2 years ago

I tried creating a new rc file though that prompt. It doesn't work either:

Config file '' does not exist, create it? [y/N]: y
io.nim(759)              open
Error: unhandled exception: cannot open:  [IOError]

Clean build of the program didn't help either.

jaker-dotcom commented 2 years ago

Actually I am thinking that maybe I just haven't used taskopen since the release of 2.0. After all the man says that release is/was in mid 2022. If that's the case, how do I get taskopen to recognize my old notes? It says that taskopen v.1 flag "-n" is to be replaced with "--include=notes" but that does not change the output.

Could it be, that with v.2 taskopen does not recognize the NOTES_REGEX that I set in the config for taskopen v.1? I set it to "taskopen_notes". How could I tell it to recognize it?


Ok so I found it in the man taskopenrc:

notes.command = "$EDITOR $HOME/tasknotes/$UUID.txt"

The section "MIGRATION FROM TASKOPEN 1.x" implies that "-n" was just replaced by "--include=notes". Instead it should give a heads up that this functionality must be implemented via creation of an action in the taskopenrc.

This also doesn't explain why the program fails to create a config file. Should I dump my old config and start from anew? Because currently it doesn't work, still. But I see now that this is probably due to my mistakes. I post my current ~/.config/taskopen/taskopenrc the below:

[General]
EDITOR = nvim
path_ext = /usr/share/taskopen/scripts
taskbin = task
no_annotation_hook = addnote
task_attributes = priority,project,tags,description

[Actions]
notes.regex = "Notes"
notes.command = "$EDITOR $HOME/doc/tasknotes/$UUID.md"

The folder for tasknotes exists already.

Also I'd like to keep the no_annotation_hook to add a note according to NOTES_REGEX. Where is the function of no_annotation_hook = addnote defined and is it customizable?

At first of course I am not so keen to have my workflow disrupted but I am beginning to sense the power of this rewrite already!

jaker-dotcom commented 2 years ago

I found the no_annotation_hook = addnote script in the scripts folder at /usr/share/taskopen/scripts. I adopted it to use my previous NOTES_REGEX. So the current state is that the no_annotation_hook does work. But for some reason it doesn't trigger the notes action. This might be due to

  1. the notes.regex (impossible since I set it to the same value as the addnote script annotation)
  2. taskopen for some reason not finding the config file both in .taskopenrc and .config/taskopen/tasopenrc
  3. something with the editnote script is off. I have $EDITOR=nvim.
jschlatow commented 2 years ago

@jaker-dotcom sorry for the inconvenience. I'm trying to catch up with your comments at the moment. Can you please post the output of taskopen diagnostics?

jschlatow commented 2 years ago

I think it is due to the program not finding the config file and thus not the notes folder and not knowing the NOTES_REGEX. The taskopenrc is located at /home/user/.config/taskopen/taskopenrc, as specified in man taskopenrc. Even specifying the file via taskopen -c /home/user/.config/taskopen/taskopenrc does not solve the problem. It yields Config file '' does not exist, create it? [y/N]: even though the file exists!

Any idea?

The nim parseopt module expects a delimiter when using short options, i.e. you must type -c=/home/user/.config/taskopen/taskopenrc or -c:/home/user/.config/taskopen/taskopenrc or --config /home/user/.config/taskopen/taskopenrc

jaker-dotcom commented 2 years ago

Hey there! Thanks for looking into this. Here's the output of taskopen diagnostics

Environment
  Platform:       Linux
  Taskopen:       fatal: No names found, cannot describe anything.
  Taskwarrior:    2.6.2
  Configuration:  /home/jakob/.config/taskopenrc
Current configuration
  Binaries and paths:
    taskbin            = task
    taskargs           = 
    editor             = nvim
    path_ext           = /usr/share/taskopen/scripts
  General:
    debug              = false
    no_annotation_hook = addnote $ID
    task_attributes    = priority,project,tags,description
  Action groups:
  Subcommands:
    default            = normal
  Actions:
    files
      .target          = annotations
      .regex           = ^[\.\/~]+.*\.(.*)
      .labelregex      = .*
      .command         = xdg-open $FILE
      .modes           = batch,any,normal

-c with delim works indeed. Yet with the automatically created config the program still fails.

I wrote the comments concurring with understanding the problem. Hope they're understandable anyway. If not, please ask!

jschlatow commented 2 years ago

You seem to have multiple config files. The active config is /home/jakob/.config/taskopenrc, whivh does not contain a notes action. Do you have $TASKOPENRC set?

jschlatow commented 2 years ago

Closing due to inactivity. @jaker-dotcom please re-open this issue if your problem persists.