GNOME Bugzilla – Bug 584560
Rename gjs-console to gjs and add support for shebang
Last modified: 2009-08-01 01:32:14 UTC
To make it easier to write gjs apps, I propose that 1. gjs-console is renamed to gjs 2. shebang is added so things like #!/usr/bin/gjs // javascript code follows work as one would expect.
Sounds good to me.
Created attachment 135782 [details] [review] Add support for UNIX shebang Here's a patch to handle UNIX shebang. It's more complicated to rename gjs-console to gjs since the gjs/ directory is kinda in the way :-/
well, if we reform all those pesky srcdir=builddir people there's no problem ;-) s = strstr (script, "\n"); if (s != NULL) { len -= (s - script); should subtract one more "len" to also chop the newline? or do I have it wrong? g_debug ("script = '%s'", script); don't want to leave these in here If gjs_context_eval() just stripped #! first line, some of the cut-and-pastes here could be cleaned up, which might be nice. Maybe all of them if we just don't allow #! in imported modules, which seems fine to me.
Created attachment 135785 [details] [review] updated patch (In reply to comment #3) > well, if we reform all those pesky srcdir=builddir people there's no problem > ;-) Heh. We could also just create a hardlink in install-exec-hook. I mean, you probably want the gjs-console for compat reasons. > > s = strstr (script, "\n"); > if (s != NULL) { > len -= (s - script); > > should subtract one more "len" to also chop the newline? or do I have it wrong? > > g_debug ("script = '%s'", script); > > don't want to leave these in here > > If gjs_context_eval() just stripped #! first line, some of the cut-and-pastes > here could be cleaned up, which might be nice. Maybe all of them if we just > don't allow #! in imported modules, which seems fine to me. Yeah, that sounds easier. Updated patch attached. This also includes a fix for the off-by-one bug pointed out above.
Looks good to me.
Committed, thanks. Keeping the bug open for the renaming stuff.
Created attachment 138911 [details] [review] Bug 584560 - Add symbolic link from gjs to gjs-console in $(bindir) We'd like people to be able to type 'gjs' to run.
(In reply to comment #7) > Created an attachment (id=138911) [edit] > Bug 584560 - Add symbolic link from gjs to gjs-console in $(bindir) > > We'd like people to be able to type 'gjs' to run. Makes sense. Pushed.
I guess this bug can be closed now. Feel free to reopen if you think there's something still missing.