Thomas Koch a écrit :
Am Donnerstag 19 Juni 2008 20:37:44 schrieb Hans Melis:
Hi Thomas,

Thomas Koch wrote:
Hi,

I'm about to start implementing

#010534: Command Line Runner to install/save Database Schemes

and would like to get your feedback on the following suggestions:


commandline tools in eZComponents
=================================

 - scripts are executable, without suffix (.php) and start
   with ezc-COMPID-, where COMPID specifies the component
   they belong to. The COMPID can be a shortcut like
   dbschema for DatabaseSchema.

   The minus signs are borrowed from git, but we can also
   agree on dropping them.
I'm worried about the "without suffix" part. Could you please elaborate
on why you'd create scripts without the .php extension?

Regards,
Hans

Hi Hans,

thanks for your interest! As with many things in programming, I think it is a matter of taste to skip the ".php". :-)

Some reasons that come to my mind:

- By skipping the .php you indicate that you do not call them via #> php myscript.php but directly via
   #> myscript
- Many commands that you call from the commandline are not compiled, but actually scripts in different languages: perl, python, shellscript. But only very few of this scripts are suffixed with .pl, .py of .sh

- Take for example GIT: Many commands were initially shell scripts, but have been reimplemented or will be reimplemented in C, to make them faster. If you'd have suffixed them with .sh, you would need to keep the suffix, even for C programms.

- The commandline is short: If you show the current dir in the prompt and have many options, then you easily span over two lines when entering a command. This is complicate to read and therefor I like short commands.
Use a terminal with more chars per line ;)
- Even if you have tab completion, then there is still one keystroke more to complete the command with ".php".

Do you have reasons, why you worry about the ".php"?
Windows!
You can set up the equivalent of the hashbang there, but afaict almost nobody does. And no execute bit, means people invoke scripts using "php" on the command line (technically double clicking could work, but it makes hard to read the output ;) Plus people are so used to seeing the .php extensions they would be puzzled to find a php file that does not have it - in the past the .inc extension already messed up way too much with this. I also always run the php cli using a different ini file than the web version on unix, so the command looks more like /usr/local/bin/php5 -c /etc/php5/cli - this is going to happen esp. when you have lots of different php installs on one box. Shell scripts are a bit different imho: 1- they were used without suffix from day one, and 2- they do not have an ini file with a ton of options anyway

just my 2c
Gaetano
What do you think about the rest of my proposal?

Best regards,

-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to