-
- /**
- * @inheritdoc
- * @see \pharext\Command::getArgs()
- */
- public function getArgs() {
- return $this->args;
- }
-
- /**
- * @inheritdoc
- * @see \pharext\Command::info()
- */
- public function info($fmt) {
- if (!$this->args->quiet) {
- vprintf($fmt, array_slice(func_get_args(), 1));
- }
- }
-
- /**
- * @inheritdoc
- * @see \pharext\Command::error()
- */
- public function error($fmt) {
- if (!$this->args->quiet) {
- vfprintf(STDERR, "ERROR: $fmt", array_slice(func_get_args(), 1));
+
+ function signature($prog) {
+ try {
+ $sig = (new Phar(Phar::running(false)))->getSignature();
+ printf("%s signature of %s\n%s", $sig["hash_type"], $prog,
+ chunk_split($sig["hash"], 64, "\n"));
+ return 0;
+ } catch (\Exception $e) {
+ $this->error("%s\n", $e->getMessage());
+ return 2;