Nushell "fill"
I'm currently learning Nushell and I wanted to know, how I can fill a number with leading zeros. ChatGPT answered this:
This translates to:
-a 0-> fill with0-w 5-> to a with of 5 characters
Okay, I found out, that the command fill exists. But the code just did nothing. Why? because the flags are wrong.
In this scenario I learned about fill, but I had to check the flags. Usually tools bring manuals with, like the unix manual pages, a help command, documentation website, and so on. I would recommend at this point not to ask AI, but instead improving your search skills by searching the help for the command. In my case, using nushell, I just typed help fill.
The help page for fill shows this:
So -a is not the fill character, it is the alignment, which should be r. But there is also -c, which is the character, which should be 0. Thus creating the correct answer:
let x = 42
print ($x | fill -a r -c 0 -w 4)