Reply to message «Re: script to download scripts from vim.org», 
sent 07:10:50 18 March 2011, Friday
by Amit Agarwal:

> I wanted a while loop so that user can stay in the script and do
> multiple things in one go. Can getopts be used in that situation. Please
> help me on how to do it.
The getopt is to be used for user not to stay in the script but launch it each 
time he needs to do something; it is more useful then menu because 0) if one 
runs your script with a typo (in plugin name, for example), it is more easily 
corrected in shell command-line then; 1) I prefer Z line editor to any input 
editing read provides; 2) it makes your script able to be used in users' 
scripts. If you make scripts list stay in /tmp after script exits and make a 
code that will ignore it if it is 1 hour old, then this will be possible.

> +AD4 5. I would have used perl for it. And no HTML regex parsing+ACEAIQAh
> Personal preference, I would say.
Perl - yes. «No HTML regex parsing» - no: HTML should not be parsed with regex 
because it is not a regular language and thus every regex parser is very prone 
to errors, especially when something changes even slightly.

By the way, why you message contains lots of {plus}AD4, {plus}ALs and other 
{plus}A{something}? It is not very easy to find you reply with these.

Original message:
> On Thu, 2011-03-17 at 20:50 +-0300, ZyX wrote:
> +AD4 Reply to message +AKs-script to download scripts from vim.org+ALs,
> +AD4 sent 19:17:06 17 March 2011, Thursday
> +AD4 by Amit Agarwal:
> +AD4
> +AD4 Some notes:
> +AD4 1. +AKs-grep pat1 +AHw grep pat2 +AHw sed 's/pat3/repl/g'+ALs can be
> replaced with a single +AD4 +AKs-sed '/pat1/+ACE d+ADs /pat2/+ACE d+ADs
> s/pat3/repl/g'+ALs. +AD4 2. Most tr calls can also be merged into sed
> command.
> +AD4 3. The whole
> +AD4     tr -d
> '+AFw-001'-'+AFw-011''+AFw-013''+AFw-014''+AFw-016'-'+AFw-037''+AFw-200'-'
> +AFw-377' +AD4 can be replaced with
> +AD4     trd+AD0AIg-tr -d
> '+AFwAXA-001-+AFwAXA-011+AFwAXA-013+AFwAXA-014+AFwAXA-016-+AFwAXA-037+AFwA
> XA-200-+AFwAXA-377'+ACI +AD4     +ACQ-trd
> +AD4 You don't need so many quotes and as it is widely used the you should
> either put +AD4 it into function or use a variable.
> 
> Yes, agree with this. This started with a one liner and became a
> complete script so forgot to do all this. Will make these changes.
> +AD4 4. Why are you using menu with +AGA-read read+AF8-choice' (and other
> reads) and not +AD4 command-line options? It reminds me of the time when I
> learned programming at +AD4 school and wrote programs with scanf() where
> now I use getopt.
> 
> I wanted a while loop so that user can stay in the script and do
> multiple things in one go. Can getopts be used in that situation. Please
> help me on how to do it.
> 
> +AD4 5. I would have used perl for it. And no HTML regex parsing+ACEAIQAh
> 
> Personal preference, I would say.
> 
> +AD4 6. Code should be put under VCS if you want someone to help you. For
> simple code +AD4 snippets there are gists on github, but I'd used
> fully-featured repositories on +AD4 bitbucket (not because github does not
> have ones alongside with gists, but +AD4 because I don't like git. On
> bitbucket gist request has status open and is two +AD4 years old).
> 
> I am thinking of putting it into sf.net now. I just wanted to get a
> opinion first as to wheather it is useful or not.
> +AD4
> +AD4 Original message:
> +AD4 +AD4 Hi All,
> +AD4 +AD4
> +AD4 +AD4 I have written a script to download scripts for vim directly from
> the +AD4 +AD4 www.vim.org site.
> +AD4 +AD4 Please find a link to the same :
> +AD4 +AD4
> http://blog.amit-agarwal.co.in/2011/03/09/all-in-one-solution-for-all-the-
> s +AD4 +AD4 cripts-of-vim-from-vim-org/
> +AD4 +AD4
> +AD4 +AD4 I would like to put that on www.vim.org site, if that is
> possible. +AD4 +AD4 Please help me with your comments and reviews and if
> you think this will +AD4 +AD4 be helpful for the vim users.

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to