psi-header icon indicating copy to clipboard operation
psi-header copied to clipboard

Feature Request: can we have arbitrary header content generation ?

Open akharrou opened this issue 3 years ago • 1 comments

Hi,

Sometimes you want to dynamically generate the contents of your header, i.e fill the header in with data that you don't know what it will be until the time of generation. For example, I would like to generate a UUID for each file and have it placed in the header.

Could you add a UUID command like you have for date generation (i.e filecreated) or would it be possible to have some syntax to include some arbitrary shell command or javascript command, or your custom syntax that you could parse and execute on our behalf to specify how the header content should be generated ?

E.g.:

  "template": [
                "uuid: <<command(shell OR javascript to produce uuid)>>",
                "created: <<filecreated('dddd, MMMM DD, YYYY \\a\\t HH:mm:ss \\U\\T\\CZ')>>"
                "modified: <<dateformat('dddd, MMMM DD, YYYY \\a\\t HH:mm:ss \\U\\T\\CZ')>>"
                 .
                 .
                 .
  ]
---
uid: bd5ac83b-cb7f-40d0-80ee-de48b213ffd1
created: Monday, January 24, 2022 at 12:33:28 UTC+06:00
modified: Tuesday, January 25, 2022 at 08:27:59 UTC+06:00
.
.
.
---

Thanks for the great plugin !

akharrou avatar Jan 25 '22 05:01 akharrou

I am sure I could add a system function that would generate a uuid. Let me take a look.

As for generating other random output that is likely to be far more difficult due to the way VSC extensions run. I suspect it will not be possible, but I will investigate.

Regards David

davidquinn avatar Apr 30 '22 15:04 davidquinn