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

What does the template option in the configuration do? #827

Closed
RaghavRao opened this issue Jan 31, 2020 · 8 comments
Closed

What does the template option in the configuration do? #827

RaghavRao opened this issue Jan 31, 2020 · 8 comments
Assignees
Labels
documentation Improvements or additions to documentation 🔒 Outdated support End user support

Comments

@RaghavRao
Copy link

Support request

Hello! Thank you for reporting an issue!
If you would fill out the below points, that would make our process a whole lot easier!

  • Please tell us about your environment:

    • Jrnl version: 2.1.1

    • How you installed Jrnl: pip install jrnl

    • Operating system [MacOS, Linux, Windows?]: Fedora 31 (Linux)

  • What are you trying to do?

What is the template option in jrnl.yaml? This is not mentioned in the Advanced Usage guide on the webpage. Is this option to be changed to use jrnl < template.txt ?

@RaghavRao RaghavRao added 🆕 New! support End user support labels Jan 31, 2020
@heymajor
Copy link
Contributor

heymajor commented Feb 1, 2020

Go one below that to recipes.

Relevant piece:

Using templates

Say you always want to use the same template for creating new entries.
If you have an external editor set up, you can use this:

jrnl < my_template.txt
jrnl -1 --edit

Another nice solution that allows you to define individual prompts comes
from Jacobo de
Vera
:

function log_question()
{
   echo $1
   read
   jrnl today: ${1}. $REPLY
}
log_question 'What did I achieve today?'
log_question 'What did I make progress with?'

@RaghavRao
Copy link
Author

RaghavRao commented Feb 1, 2020 via email

@heymajor
Copy link
Contributor

heymajor commented Feb 1, 2020

Good question; it's not very clear.

After some tinkering, here's what I think is being said:

If you put the function text block on your .bashrc:

function log_question()
{
   echo $1
   read
   jrnl today: ${1}. $REPLY
}
log_question 'What did I achieve today?'
log_question 'What did I make progress with?'

...you'll be prompted when you reload your shell (source ~/.bashrc). Your answers will be saved at the default_hour and default_minute you set in your config.

Commented on these two commands:

jrnl < my_template.txt     # Imports my_template.txt as the most recent entry
jrnl -1 --edit       # Opens the most recent entry in the editor 

So to answer your original question: The template setting is either false or a double quoted path to the file you want to open in your editor to start your entry like this:

...
tagsymbols: "@"
template: "/path/to/template.txt"
timeformat: '%Y-%m-%d %H:%M'
version: "2.1.1"

@micahellison
Copy link
Member

Thanks @RaghavRao and @heymajor for the question and answer. Sounds like we need to update the documentation. I'm making some notes here on what to change when I get to it:

  • Modify the "advanced" page to mention the template field
  • Modify the template info in the recipes page to mention the configuration file
  • And, after some quick testing - specify that it won't use the template if you enter a subject line as a command line argument

@micahellison micahellison added documentation Improvements or additions to documentation and removed 🆕 New! labels Feb 1, 2020
@micahellison micahellison self-assigned this Feb 1, 2020
@heymajor
Copy link
Contributor

heymajor commented Feb 1, 2020

  • Modify the "advanced" page to mention the template field
  • Modify the template info in the recipes page to mention the configuration file

I submitted a pull request that should hopefully take care of these

@micahellison
Copy link
Member

Oh I see! PR #829. Like a half hour before that comment. I'll take a look.

@lock
Copy link

lock bot commented May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

1 similar comment
@lock
Copy link

lock bot commented May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the 🔒 Outdated label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation 🔒 Outdated support End user support
Projects
None yet
Development

No branches or pull requests

3 participants