<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/atom.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Posts tagged: copier</title>
  <id>https://waylonwalker.com/tags/copier/atom.xml</id>
  <updated>2025-06-19T08:04:51Z</updated>
  <subtitle>All posts with the tag &#34;copier&#34;</subtitle>
  <link href="https://waylonwalker.com/tags/copier/" rel="alternate" type="text/html"></link>
  <link href="https://waylonwalker.com/tags/copier/atom.xml" rel="self" type="application/atom+xml"></link>
  <author>
    <name>Waylon Walker</name>
  </author>
  <generator uri="https://github.com/WaylonWalker/markata-go">markata-go</generator>
  <entry>
    <title>copier vcs quirks</title>
    <id>https://waylonwalker.com/copier-vcs-quirks/</id>
    <updated>2025-06-19T08:04:51Z</updated>
    <published>2025-06-19T08:04:51Z</published>
    <link href="https://waylonwalker.com/copier-vcs-quirks/" rel="alternate" type="text/html"></link>
    <summary type="text">Copier has a few quirks with vcs that I just discovered by trying to test out some changes. I may have some config that I have long forgotten about somewhere...</summary>
    <content type="html">&lt;p&gt;Copier has a few quirks with vcs that I just discovered by trying to test out&#xA;some changes.  I may have some config that I have long forgotten about&#xA;somewhere deep in my dotfiles, I don’t think so, but id love to be wrong and&#xA;corrected, please reach out.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-doesnt-work&#34;&gt;What Doesn’t Work &lt;a href=&#34;#what-doesnt-work&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I tried throwing everything at this template to make it work.  I tried a bunch&#xA;of flags that did not work. I tried making commits to the local repo to get rid&#xA;of the dirty warning. I really wanted to test new changes locally without&#xA;committing and pushing untested and potentially broken changes.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;uvx copier copy ../markata-blog-starter .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;uvx copier copy gh:waylonwalker/markata-blog-starter@develop .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;uvx copier copy ../markata-blog-starter . -wlg --trust&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;what-works-----vcs-ref&#34;&gt;What Works - –vcs-ref &lt;a href=&#34;#what-works-----vcs-ref&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Finally after trying everything to get the local copy to work, and my guess of&#xA;@branch not working I found this to work.  It does require me to go to the repo&#xA;on my develop branch.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;uvx copier copy gh:waylonwalker/markata-blog-starter --vcs-ref develop .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;what-works---delete-&lt;a href=&#34;/glossary/git/&#34; class=&#34;glossary-term&#34; title=&#34;Git is a version control system for tracking changes in source code during software development. In the beginning there were many, some were licensed. As...&#34;&gt;git&lt;/a&gt;&#34;&gt;What Works - delete .git &lt;a href=&#34;#what-works---delete-git&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Really this might be my best option to make quick changes and test them locally&#xA;without going through a version control system.  It is not ideal, but makes it&#xA;easy to quickly iterate on.  I might be renaming .git, or copying to /tmp for&#xA;quick iteration.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;rm -rf .git&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;uvx copier copy ../markata-blog-starter .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;copier-i-love&#34;&gt;Copier I love &lt;a href=&#34;#copier-i-love&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Copier is a great templating tool.  I really love it.  I use it every single&#xA;day to create posts on this blog using &lt;a href=&#34;/tmux-copier-templates/&#34; class=&#34;wikilink&#34; data-title=&#34;Tmux hotkey for copier templates&#34; data-description=&#34;I have added a hotkey to my copier template setup to quickly access all my templates at any time from tmux. At any point I can hit , thats holding control...&#34; data-date=&#34;2022-01-24&#34; data-preview=&#34;I have added a hotkey to my copier template setup to quickly access all my templates at any time from tmux. At any point I can hit , thats holding control...&#34;&gt;Tmux hotkey for copier templates&lt;/a&gt;.  This is&#xA;the first time this quirk has got me and it had me puzzled for 45 minutes as I&#xA;did not expect this behavior whatsoever.&lt;/p&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Obsidian Using Templater Like Copier</title>
    <id>https://waylonwalker.com/obsidian-using-templater-like-copier/</id>
    <updated>2024-07-31T13:34:00Z</updated>
    <published>2024-07-31T13:34:00Z</published>
    <link href="https://waylonwalker.com/obsidian-using-templater-like-copier/" rel="alternate" type="text/html"></link>
    <summary type="text">I&#39;ve long used copier to create all of my posts for my blog, and it works really well for my workflow. I think of a title, call a template, and give it a...</summary>
    <content type="html">&lt;p&gt;I’ve long used copier to create all of my posts for my blog, and it works&#xA;really well for my workflow.  I think of a title, call a template, and give it&#xA;a title.  out of the box obsidian did not seem to work this way.  It seems like&#xA;it wants me to right click a file tree and make a new file using the tree, this&#xA;is not my jam.&lt;/p&gt;&#xA;&lt;p&gt;Here is what I came up with to replace my til template.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---&#xA;date: &amp;lt;% tp.file.creation_date() %&amp;gt;&#xA;templateKey: til&#xA;title: &amp;lt;%*&#xA;  const originalFileName = await tp.system.prompt(&amp;#34;Enter file name&amp;#34;);&#xA;  const toTitleCase = str =&amp;gt; str.replace(&#xA;    /\w\S*/g,&#xA;    txt =&amp;gt; txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()&#xA;  );&#xA;  const title = toTitleCase(originalFileName);&#xA;  tR += title + &amp;#39;\n&amp;#39;; // Add the title to the template result&#xA;-%&amp;gt;&#xA;published: true&#xA;tags:&#xA;  -&#xA;---&#xA;&amp;lt;%*&#xA;const fileName = originalFileName.toLowerCase().replace(/\s+/g, &amp;#39;-&amp;#39;);&#xA;const newFilePath = `pages/til/${fileName}`;&#xA;await tp.file.move(newFilePath);&#xA;-%&amp;gt;&#xA;&#xA;&amp;lt;% tp.file.cursor() %&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;tR&lt;/code&gt; is a return value, and it gets placed directly into the place it is in the file&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;to.file.cursor()&lt;/code&gt; creates a tab-index point so I can tab into the content&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>copier trust</title>
    <id>https://waylonwalker.com/copier-trust/</id>
    <updated>2024-04-19T20:41:06Z</updated>
    <published>2024-04-19T20:41:06Z</published>
    <link href="https://waylonwalker.com/copier-trust/" rel="alternate" type="text/html"></link>
    <summary type="text">I recently had to update my copier-gallery command to trust my own templates because some of them have shell scripts that run afterwards. Be warned that this...</summary>
    <content type="html">&lt;p&gt;I recently had to update my copier-gallery command to trust my own templates&#xA;because some of them have shell scripts that run afterwards.  Be warned that&#xA;this could be a dangerous feature to run on random templates you get off the&#xA;internet, but these are all mine, so if I wreck it its my own fault.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier copy --trust &amp;lt;template&amp;gt; &amp;lt;destination&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;All the the copier copy api can be found with help.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;❯ copier copy --help&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier copy 8.3.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Copy from a template &lt;span class=&#34;nb&#34;&gt;source&lt;/span&gt; to a destination.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Usage:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    copier copy &lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;SWITCHES&lt;span class=&#34;o&#34;&gt;]&lt;/span&gt; template_src destination_path&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Hidden-switches:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -h, --help                         Prints this &lt;span class=&#34;nb&#34;&gt;help&lt;/span&gt; message and quits&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    --help-all                         Prints &lt;span class=&#34;nb&#34;&gt;help&lt;/span&gt; messages of all sub-commands and quits&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -v, --version                      Prints the program&lt;span class=&#34;err&#34;&gt;&amp;#39;&lt;/span&gt;s version and quits&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Switches:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -C, --no-cleanup                   On error, &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; not delete destination &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; it was&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       created by Copier.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    --UNSAFE, --trust                  Allow templates with unsafe features &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;Jinja&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       extensions, migrations, tasks&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -a, --answers-file VALUE:str       Update using this path &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;relative to&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       &lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;destination_path&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; to find the answers file&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -d, --data &lt;span class=&#34;nv&#34;&gt;VARIABLE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;VALUE:str      Make VARIABLE available as VALUE when rendering the&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       template&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; may be given multiple &lt;span class=&#34;nb&#34;&gt;times&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -f, --force                        Same as &lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;--defaults --overwrite&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -g, --prereleases                  Use prereleases to compare template VCS tags.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -l, --defaults                     Use default answers to questions, which might be&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       null &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; not specified.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -n, --pretend                      Run but &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; not make any changes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -q, --quiet                        Suppress status output&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -r, --vcs-ref VALUE:str            Git reference to checkout in &lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;template_src&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;. If you&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; not specify it, it will try to checkout the&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       latest git tag, as sorted using the PEP &lt;span class=&#34;m&#34;&gt;440&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       algorithm. If you want to checkout always the&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       latest version, use &lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;--vcs-ref&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;HEAD&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -s, --skip VALUE:str               Skip specified files &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; they exist already&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; may be&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       given multiple &lt;span class=&#34;nb&#34;&gt;times&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -w, --overwrite                    Overwrite files that already exist, without asking.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    -x, --exclude VALUE:str            A name or shell-style pattern matching files or&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       folders that must not be copied&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; may be given&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                       multiple &lt;span class=&#34;nb&#34;&gt;times&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Copier Slugify | python templating | using cookiecutter</title>
    <id>https://waylonwalker.com/copier-slugify/</id>
    <updated>2022-06-11T12:37:50Z</updated>
    <published>2022-06-11T12:37:50Z</published>
    <link href="https://waylonwalker.com/copier-slugify/" rel="alternate" type="text/html"></link>
    <summary type="text">It&#39;s no secret that I love automation, and lately my templating framework of choice has been copier. One hiccup I recently ran into was having spaces in my...</summary>
    <content type="html">&lt;p&gt;It’s no secret that I love automation, and lately my templating framework of&#xA;choice has been copier.  One hiccup I recently ran into was having spaces in my&#xA;templated directory names.  This makes it harder to run commands against as you&#xA;need to escape them, and if they end up in a url you end up with ugly &lt;code&gt;%20&lt;/code&gt; all&#xA;over.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cookiecutter-has-the-solution&#34;&gt;Cookiecutter has the solution &lt;a href=&#34;#cookiecutter-has-the-solution&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Yes the solution comes from a competing templating framework.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I install copier with pipx, so I need to inject cookiecutter in to my copier&#xA;environment to use the slugify filter.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pipx inject copier cookiecutter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you are using a normal &lt;a href=&#34;/virtual-environment/&#34; class=&#34;glossary-term&#34; title=&#34;Virtual Environment is term for a sandboxed environment commonly associated with the python programming language. If you are installing any sort of python...&#34;&gt;virtual environment&lt;/a&gt; you can just pip install it.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pip install copier cookiecutter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;add-the-extension-to-your-template&#34;&gt;add the extension to your template &lt;a href=&#34;#add-the-extension-to-your-template&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;copier.yml&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now to enable the extension you need to declare it in your &lt;code&gt;copier.yml&lt;/code&gt; file in&#xA;your template.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nt&#34;&gt;_jinja_extensions&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;- &lt;span class=&#34;l&#34;&gt;cookiecutter.extensions.SlugifyExtension&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;use-it--slugify&#34;&gt;Use it | slugify &lt;a href=&#34;#use-it--slugify&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;use-it&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now to use it, anywhere that you want to slugify a variable, you just pipe it&#xA;into slugify.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;❯ tree .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;├── copier.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;├── README.md&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;└── &lt;span class=&#34;o&#34;&gt;{{&lt;/span&gt; site_name&lt;span class=&#34;p&#34;&gt;|&lt;/span&gt;slugify &lt;span class=&#34;o&#34;&gt;}}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    └── markata.toml.jinja&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; directory, &lt;span class=&#34;m&#34;&gt;3&lt;/span&gt; files&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here is a slimmed down version of what the &lt;code&gt;copier.yml&lt;/code&gt; looks like.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nt&#34;&gt;site_name&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;type&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;str&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;help&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;What is the name of your site, this shows in seo description and the site title.&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;default&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;Din Djarin&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_jinja_extensions&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;- &lt;span class=&#34;l&#34;&gt;cookiecutter.extensions.SlugifyExtension&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;results&#34;&gt;Results &lt;a href=&#34;#results&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Running the template looks a bit like this.&lt;/p&gt;&#xA;&lt;figure&gt;&#xA;&lt;a href=&#34;https://dropper.waylonwalker.com/api/file/ffd34b52-cef7-4de8-b451-4426989fb70c.webp&#34; class=&#34;glightbox-link&#34;&gt;&lt;img class=&#34;glightbox&#34; src=&#34;https://dropper.waylonwalker.com/api/file/ffd34b52-cef7-4de8-b451-4426989fb70c.webp&#34; alt=&#34;copier-cookiecutter-slugify.webp&#34;/ data-glightbox=&#34;description: copier-cookiecutter-slugify.webp&#34;&gt;&lt;/a&gt;&#xA;&lt;/figure&gt;&#xA;&lt;hr/&gt;&#xA;&lt;h2 id=&#34;straight-from-their-docs&#34;&gt;straight from their docs &lt;a href=&#34;#straight-from-their-docs&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;The next section is straight from the &lt;a href=&#34;https://cookiecutter.readthedocs.io/en/latest/advanced/template_extensions.html#slugify-extension&#34; style=&#34;--favicon-url: url(&amp;#39;/assets/markata/link-avatars/cookiecutter.readthedocs.io.ico&amp;#39;);&#34; data-favicon=&#34;/assets/markata/link-avatars/cookiecutter.readthedocs.io.ico&#34; class=&#34;has-avatar  has-avatar-before&#34;&gt;cookiecutter docs&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;slugify-extension&#34;&gt;Slugify extension &lt;a href=&#34;#slugify-extension&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;cookiecutter.extensions.SlugifyExtension&lt;/code&gt; extension provides a &lt;code&gt;slugify&lt;/code&gt;&#xA;filter in templates that converts string into its dashed (“slugified”) version:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;x&#34;&gt;{% &amp;#34;It&amp;#39;s a random version&amp;#34; | slugify %}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Would output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;it-s-a-random-version&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It is different from a mere replace of spaces since it also treats some special&#xA;characters differently such as &lt;code&gt;&amp;#39;&lt;/code&gt; in the example above. The function accepts&#xA;all arguments that can be passed to the &lt;code&gt;slugify&lt;/code&gt; function of&#xA;&lt;code&gt;python-slugify&lt;/code&gt;_. For example to change the output from&#xA;&lt;code&gt;it-s-a-random-version&lt;/code&gt; to &lt;code&gt;it_s_a_random_version&lt;/code&gt;, the &lt;code&gt;separator&lt;/code&gt; parameter&#xA;would be passed: &lt;code&gt;slugify(separator=&amp;#39;_&amp;#39;)&lt;/code&gt;.&lt;/p&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Copier &lt; 6.0.0b0 considered dangerous</title>
    <id>https://waylonwalker.com/update-copier/</id>
    <updated>2022-04-30T10:05:45Z</updated>
    <published>2022-04-30T10:05:45Z</published>
    <link href="https://waylonwalker.com/update-copier/" rel="alternate" type="text/html"></link>
    <summary type="text">Copier is a fantastic templating library written in python, but older versions have a dangerous bug if you are using it inside of existing directories.</summary>
    <content type="html">&lt;p&gt;Copier is a fantastic templating library written in python, but older versions&#xA;have a dangerous bug if you are using it inside of existing directories.&lt;/p&gt;&#xA;&lt;h2 id=&#34;update&#34;&gt;!!UPDATE &lt;a href=&#34;#update&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;As of May 15, 2022, the stable release of copier now includes these changes, if&#xA;you have not already make sure you update.&lt;/p&gt;&#xA;&lt;h2 id=&#34;this-is-a-psa&#34;&gt;This is a PSA &lt;a href=&#34;#this-is-a-psa&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I Use copier several times per day and get fantastic benefit from this project,&#xA;this post is not intended to crap all over copier in any way, but is rather a&#xA;PSA for other users who do use copier like I do so that they know the dangers&#xA;of using copier inside an existing directory.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-issue&#34;&gt;The issue &lt;a href=&#34;#the-issue&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;h2 id=&#34;the-fix&#34;&gt;The fix &lt;a href=&#34;#the-fix&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/copier-org/copier/pull/273&#34; style=&#34;--favicon-url: url(&amp;#39;/assets/markata/link-avatars/github.com.ico&amp;#39;);&#34; data-favicon=&#34;/assets/markata/link-avatars/github.com.ico&#34; class=&#34;has-avatar  has-avatar-before&#34;&gt;https://github.com/copier-org/copier/pull/273&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As of the time of writing this version is still in beta, if you still want to&#xA;use copier with existing directtories, I’d strongly encourage you to install&#xA;the &lt;code&gt;--pre&lt;/code&gt; release.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;pipx&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;install&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;copier&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;pip&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;args&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;--pre&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;confirm&#34;&gt;confirm &lt;a href=&#34;#confirm&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# copier 6.0.0b0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;my-update-commit&#34;&gt;My update commit &lt;a href=&#34;#my-update-commit&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/WaylonWalker/devtainer/commit/a06e47462e2c6d26ad69fbdc2e7990a1a73ab4b7&#34; style=&#34;--favicon-url: url(&amp;#39;/assets/markata/link-avatars/github.com.ico&amp;#39;);&#34; data-favicon=&#34;/assets/markata/link-avatars/github.com.ico&#34; class=&#34;has-avatar  has-avatar-before&#34;&gt;https://github.com/WaylonWalker/devtainer/commit/a06e47462e2c6d26ad69fbdc2e7990a1a73ab4b7&lt;/a&gt;&lt;/p&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Tmux hotkey for copier templates</title>
    <id>https://waylonwalker.com/tmux-copier-templates/</id>
    <updated>2022-01-24T02:22:53Z</updated>
    <published>2022-01-24T02:22:53Z</published>
    <link href="https://waylonwalker.com/tmux-copier-templates/" rel="alternate" type="text/html"></link>
    <summary type="text">I have added a hotkey to my copier template setup to quickly access all my templates at any time from tmux. At any point I can hit , thats holding control...</summary>
    <content type="html">&lt;p&gt;I have added a hotkey to my copier template setup to quickly access all my&#xA;templates at any time from tmux.  At any point I can hit &lt;code&gt;&amp;lt;c-b&amp;gt;&amp;lt;c-b&amp;gt;&lt;/code&gt;, thats&#xA;holding control and hitting &lt;code&gt;bb&lt;/code&gt;, and I will get a popup list of all of my&#xA;templates directory names.  Its an fzf list, which means that I can fuzzy&#xA;search through it for the template I want, or arrow key to the one I want if I&#xA;am feeling insane.  I even setup it up so that the preview is a list of the&#xA;files that come with the template in tree view.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;bind-key c-b popup -E -w 80% -d &lt;span class=&#34;s1&#34;&gt;&amp;#39;#{pane_current_path}&amp;#39;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;    pipx run copier copy ~/.copier-templates/`ls ~/.copier-templates |\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;    fzf --header &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;pwd&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt; --preview=&amp;#39;tree ~/.copier-templates/{} |\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;    lolcat&amp;#39;` . \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;    &amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I’ve had this on my systems for a few weeks now and I am constantly using it&#xA;for my &lt;a href=&#34;https://waylonwalker.com/til/&#34;&gt;tils&lt;/a&gt;,&#xA;&lt;a href=&#34;https://waylonwalker.com/archive&#34;&gt;blogs&lt;/a&gt;, and my .envrc file that goes into&#xA;all of my projects to make sure that I have a &lt;a href=&#34;/virtual-environment/&#34; class=&#34;glossary-term&#34; title=&#34;Virtual Environment is term for a sandboxed environment commonly associated with the python programming language. If you are installing any sort of python...&#34;&gt;virtual environment&lt;/a&gt; installed and&#xA;running any time I open it.&lt;/p&gt;&#xA;&lt;figure&gt;&#xA;&lt;a href=&#34;https://images.waylonwalker.com/copier-templates-tmux-popup.png&#34; class=&#34;glightbox-link&#34;&gt;&lt;img class=&#34;glightbox&#34; src=&#34;https://images.waylonwalker.com/copier-templates-tmux-popup.png&#34; alt=&#34;this is what it looks like when I open my copier templates popup&#34;/ data-glightbox=&#34;description: this is what it looks like when I open my copier templates popup&#34;&gt;&lt;/a&gt;&#xA;&lt;/figure&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Copier Tasks | Python templating post run task</title>
    <id>https://waylonwalker.com/copier-tasks/</id>
    <updated>2022-01-22T04:49:12Z</updated>
    <published>2022-01-22T04:49:12Z</published>
    <link href="https://waylonwalker.com/copier-tasks/" rel="alternate" type="text/html"></link>
    <summary type="text">Copier allows you to run post render tasks, just like cookiecutter. These are defined as a list of in your . They are simply shell commands to run.</summary>
    <content type="html">&lt;p&gt;Copier allows you to run post render tasks, just like cookiecutter. These are&#xA;defined as a list of &lt;code&gt;tasks&lt;/code&gt; in your &lt;code&gt;copier.yml&lt;/code&gt;.  They are simply shell&#xA;commands to run.&lt;/p&gt;&#xA;&lt;p&gt;The example I have below runs an &lt;code&gt;update-gratitude&lt;/code&gt; bash script after the&#xA;copier template has been rendered.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;# copier.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;num&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;m&#34;&gt;128&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_answers_file&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;.gratitude-copier-answers.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_tasks&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;- &lt;span class=&#34;s2&#34;&gt;&amp;#34;update-gratitude&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I have put the script in &lt;code&gt;~/.local/bin&lt;/code&gt; so that I know it’s always on my&#xA;&lt;code&gt;$PATH&lt;/code&gt;.  It will reach back into the &lt;code&gt;copier.yml&lt;/code&gt; and update the default&#xA;number.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;# ~/.local/bin/update-gratitude&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;current&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;{print $2}&amp;#39;&lt;/span&gt; ~/.copier-templates/gratitude/copier.yml &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; head -n 1&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;new&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;expr &lt;span class=&#34;nv&#34;&gt;$current&lt;/span&gt; + 1&lt;span class=&#34;sb&#34;&gt;`&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;$current&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;$new&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s2&#34;&gt;&amp;#34;s/&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$current&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$new&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/g&amp;#34;&lt;/span&gt; ~/.copier-templates/gratitude/copier.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Using Copier Answers to rerun templates quickly</title>
    <id>https://waylonwalker.com/copier-answers/</id>
    <updated>2022-01-08T01:16:52Z</updated>
    <published>2022-01-08T01:16:52Z</published>
    <link href="https://waylonwalker.com/copier-answers/" rel="alternate" type="text/html"></link>
    <summary type="text">The copier answers file is a key component to making your templates re-runnable. Let&#39;s look at the example for my setup.py.</summary>
    <content type="html">&lt;p&gt;The copier answers file is a key component to making your templates&#xA;re-runnable.  Let’s look at the example for my setup.py.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;❯ tree ~/.copier-templates/setup.py&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/home/walkers/.copier-templates/setup.py&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;├── &lt;span class=&#34;o&#34;&gt;[[&lt;/span&gt; _copier_conf.answers_file &lt;span class=&#34;o&#34;&gt;]]&lt;/span&gt;.tmpl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;├── copier.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;├── setup.cfg&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;└── setup.py.tmpl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; directories, &lt;span class=&#34;m&#34;&gt;4&lt;/span&gt; files&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Inside of my &lt;code&gt;[[ _copier_conf.answers_file ]].tmpl&lt;/code&gt; file is this, a&#xA;message not to muck around with it, and the ansers in yaml form.  The&#xA;first line is just a helper for the blog post.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;# ~/.copier-templates/setup.py/\[\[\ _copier_conf.answers_file\ \]\].tmpl&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c&#34;&gt;# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[[&lt;/span&gt;&lt;span class=&#34;l&#34;&gt;_copier_answers|to_nice_yaml]]&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Inside my copier.yml I have setup my _answers_file to point to a special&#xA;file.  This is because this is not a whole projet template, but one just&#xA;for a single file.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;# copier.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c&#34;&gt;# ...&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_answers_file&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;.setup-py-copier-answers.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;Once I change the _answers_file I was incredibly stuck&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it &lt;a href=&#34;#run-it&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I’m making a library of personal copier templates in my&#xA;&lt;code&gt;~/.copier-templates&lt;/code&gt; directory and I am going to run it from there.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier copy ~/.copier-templates/setup.py&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;results&#34;&gt;Results &lt;a href=&#34;#results&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;After rendering the template we have the following content in our&#xA;&lt;code&gt;.setup.setup-py-copier-answers.yml&lt;/code&gt; file.  This will allow us to update&#xA;quick if we ever change our template.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;# .setup-py-copier-answers.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c&#34;&gt;# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_src_path&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;/home/walkers/.copier-templates/setup.py&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;author_github&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;waylonwalker&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;author_name&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;Waylon Walker&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;description&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;awesomeness&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;framework&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;keywords&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;package_name&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;my-package&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;update-it&#34;&gt;Update it &lt;a href=&#34;#update-it&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;This is where I was most stuck, primarily becuase &lt;code&gt;-a &amp;lt;answers_file&amp;gt;&lt;/code&gt;&#xA;must come exactly after the base command &lt;code&gt;copier&lt;/code&gt;.  This felt a bit odd&#xA;to and not where I expected it so it.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier -a .setup-py-copier-answers.yml update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;stop-asking-all-these-damn-questions&#34;&gt;Stop asking all these damn questions &lt;a href=&#34;#stop-asking-all-these-damn-questions&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;So the defaults are now changed to our previous results, but it keeps&#xA;asking for them.  To stop asking we can simply add a &lt;code&gt;-f&lt;/code&gt; flag.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier -fa .setup-py-copier-answers.yml update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Copier Templates</title>
    <id>https://waylonwalker.com/copier-templates/</id>
    <updated>2022-01-05T01:54:07Z</updated>
    <published>2022-01-05T01:54:07Z</published>
    <link href="https://waylonwalker.com/copier-templates/" rel="alternate" type="text/html"></link>
    <summary type="text">%%include til/copier_endops</summary>
    <content type="html">&lt;p&gt;%%include til/copier_endops&lt;/p&gt;&#xA;&lt;p&gt;%%include til/copier-template-variables&lt;/p&gt;&#xA;&lt;p&gt;%%include til/copier-answers&lt;/p&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>Changing copier template strings (_endops)</title>
    <id>https://waylonwalker.com/copier_endops/</id>
    <updated>2022-01-04T10:55:12Z</updated>
    <published>2022-01-04T10:55:12Z</published>
    <link href="https://waylonwalker.com/copier_endops/" rel="alternate" type="text/html"></link>
    <summary type="text">I was completely stuck for awhile. copier was not replacing my template variables. I found out that adding all these fixed it. Now It will support all of...</summary>
    <content type="html">&lt;p&gt;I was completely stuck for awhile.  copier was not replacing my template&#xA;variables.  I found out that adding all these &lt;code&gt;_endops&lt;/code&gt; fixed it.  Now&#xA;It will support all of these types of variable wrappers&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;# copier.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_templates_suffix&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;.jinja&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;_envops&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;block_end_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;%}&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;block_start_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;{%&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;comment_end_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#}&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;comment_start_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;{#&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;keep_trailing_newline&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;variable_end_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;}}&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;variable_start_string&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;{{&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;!RTFM: Later I read the docs and realized that copier defaults to using &lt;code&gt;[[&lt;/code&gt;&#xA;and &lt;code&gt;]]&lt;/code&gt; for its templates unlike other tools like cookiecutter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
  <entry>
    <title>copier template variables</title>
    <id>https://waylonwalker.com/copier-template-variables/</id>
    <updated>2022-01-03T12:37:32Z</updated>
    <published>2022-01-03T12:37:32Z</published>
    <link href="https://waylonwalker.com/copier-template-variables/" rel="alternate" type="text/html"></link>
    <summary type="text">I&#39;ve been looking for a templating tool for awhile that works well with single files. My go to templating tool does not work for single files, it needs to...</summary>
    <content type="html">&lt;p&gt;I’ve been looking for a templating tool for awhile that works well with&#xA;single files.  My go to templating tool &lt;code&gt;cookiecutter&lt;/code&gt; does not work for&#xA;single files, it needs to put files into a directory underneath of it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;template-variables&#34;&gt;template variables &lt;a href=&#34;#template-variables&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;By default copier uses double square brackets for its variables.&#xA;variables in files, directory_names, or file_names will be substituted&#xA;for their value once you render them.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# hello-py/hello.py.tmpl&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;hello-[[name]]&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;note! by default copier will not inject variables into your&#xA;&lt;code&gt;template-strings&lt;/code&gt; unless you use a .tmpl suffix.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Before running copier we need to tell copier what variables to ask for,&#xA;we do this with a copier.yml file.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;# copier.yml&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;default&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;my_name&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;type&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;str&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;help&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;What is your name&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;installing-copier&#34;&gt;installing copier &lt;a href=&#34;#installing-copier&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I prefer to install cli tools that I need globally with pipx, this&#xA;always gives me access to the tool without worrying about dependency&#xA;conflicts, bloating my system site-packages, or managing a separate&#xA;&lt;a href=&#34;/virtual-environment/&#34; class=&#34;glossary-term&#34; title=&#34;Virtual Environment is term for a sandboxed environment commonly associated with the python programming language. If you are installing any sort of python...&#34;&gt;virtual environment&lt;/a&gt; for it myself.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pipx install copier&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;running-copier&#34;&gt;running copier &lt;a href=&#34;#running-copier&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;When running &lt;code&gt;copier copy&lt;/code&gt; we pass in the directory of the template, and&#xA;the directory that we want to render the template into.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;copier copy hello-py .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;note! the directory ‘.’ is often referred to in cli programs to&#xA;represent the current working directory that we are calling the&#xA;command from.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;results&#34;&gt;results &lt;a href=&#34;#results&#34; class=&#34;heading-anchor&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;The resulting files will have your variables injected into them if you have&#xA;setup your template and copier.yml up correctly.&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;hello-you&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
    <author>
      <name>Waylon Walker</name>
      <email>hello@waylonwalker.com</email>
      <uri>https://waylonwalker.com</uri>
    </author>
  </entry>
</feed>