The program name specified in command line usage, e.g. "Usage: rot13.factor [OPTIONS]"
.
Erlang has a macro called ?FILE
to access the source code's own filename. Does Factor have something similar?
Factor's command-line vocabulary has a word script
which either returns the script name or f
when Factor is in interpreted mode.
#! /usr/bin/env factor
USING: namespaces io command-line ;
IN: scriptname
: main ( -- ) script get print ;
MAIN: main
Example:
$ ./scriptname.factor
Program: ./scriptname.factor
$ factor
( scratchpad ) USING: command-line ;
( scratchpad ) script get .
f