public function run() { $this->error->repository_exists(); $file = new \Pgit\Lib\File(); $working_files = $file->working_files(); $add_filename = isset($this->commands[1]) ? $this->commands[1] : null; if (!$add_filename) { echo "Nothing specified, nothing added.\nMaybe you wanted to say 'pgit add .'?\n"; exit; } if (!in_array($add_filename, $working_files)) { echo sprintf("fatal: pathspec '%s' did not match any files\n", $add_filename); exit; } $blob = new \Pgit\Lib\Blob(); $sha1 = $blob->create($add_filename); }
public function run() { $this->error->repository_exists(); $file = new \Pgit\Lib\File(); $working_files = $file->working_files(); $index = new \Pgit\Lib\Index(); $index_files = $index->get(); foreach ($working_files as $index => $working_file) { $working_file = trim($working_file); if (isset($index_files[$working_file])) { $color = 'green'; $filetype = 'modified'; } else { $color = 'red'; $filetype = 'new file'; } echo \Pgit\Lib\Color::text($color, sprintf(" %s: %s\n", $filetype, $working_file)); } }