Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Forked from anonymous/gist:4389353
Last active December 10, 2015 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaytaph/4389357 to your computer and use it in GitHub Desktop.
Save jaytaph/4389357 to your computer and use it in GitHub Desktop.
class saffire {
// Returns saffire version (should be tuple major.minor.build)
public method version();
// Returns the git revision which was used for building this saffire version
public method git_revision();
// Returns the current run_mode: "fastcgi", "repl", "cli"
public method run_mode();
// Null or fastcgi class
public property fastcgi;
// Null or cli class
public property cli;
// Null or repl class
public property repl;
}
saffire::cli {
// Hashtable with arguments (arguments[0] being the calling program)
public property arguments;
// stdin stream
public property stdin;
// stdout stream
public property stdout;
// stderr stream
public property stderr;
}
class saffire::fastcgi {
// Returns ROLE of the current fastCGI request ("responder", "authorized", "filter")
public method role();
// Finishes the request (prematurely)
public method finish();
// returns a fastCGI parameter (the environment send by the fastcgi server)
public method getParam(string key);
// FastCGI has some read/write stream functionality. Maybe implement this here as well?
}
saffire::repl.sf {
// Gets/sets the prompt for the REPL (saffire::repl.prompt(">>>");)
/*
* \d counter
* \e escape sequence (to do nifty ANSI coloring etc)
* \c current working dir
* \b current block
* \\ Actual slash
*/
public method prompt();
// If not-null, will call this method to display prompt. Any escape sequences are still parsed.
/*
* saffire::repl.set_prompt_callback(foo.bar);
*
* class foo {
* public method bar() {
* return "[" + date.now().format("H:i:s") + "] #\d>";
* }
*
* prompts:
* [12:34:56] #1>
*/
public method set_prompt_callback();
// Sets a pager command that is executed when outputting data (ie: /usr/bin/less). Defaults to null.
public method pager();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment