aboutsummaryrefslogtreecommitdiffstats
path: root/util/fresh
blob: 450d1746494d1daf7441e309be829f1c2a091928 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env php
<?php

// Red cli interpreter

require_once('include/cli_startup.php');

cli_startup();

$prompt = 'fresh% ';

function fresh_main($argc,$argv) {
	global $prompt;

	while(!feof(STDIN)) {


		if(function_exists('readline'))
			$line = readline($prompt);
		else {
			echo "\n" . $prompt;
			$line = fgets(STDIN);
		}

	
		if($line === FALSE) {
			if(feof(STDIN)) {
				break;
			}
			continue;
		}

		$line = trim($line);
 		if($line == 'quit' || $line == 'exit')
			exit();
		process_command($line);
	}

}

fresh_main($argc,$argv);

function process_command($line) {

	// split args

	if($line == 'version') {
		echo 'Fresh version 0.1';
		return;
	}




}