changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: cargo init

changeset 591: f9279a1f2347
parent 590: 71c05868c4e7
child 592: 1d6e3bbdaebb
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 12 Aug 2024 21:47:02 -0400
files: lisp/lib/cli/tools/cargo.lisp lisp/lib/cli/tools/pkg.lisp
description: cargo init
     1.1--- a/lisp/lib/cli/tools/cargo.lisp	Mon Aug 12 21:44:58 2024 -0400
     1.2+++ b/lisp/lib/cli/tools/cargo.lisp	Mon Aug 12 21:47:02 2024 -0400
     1.3@@ -4,3 +4,20 @@
     1.4 
     1.5 ;;; Code:
     1.6 (in-package :cli/tools/cargo)
     1.7+
     1.8+(deferror cargo-error (simple-error error) ())
     1.9+
    1.10+(defun cargo-error (fmt &rest args)
    1.11+  (error 'cargo-error :format-arguments args :format-control fmt))
    1.12+
    1.13+(defparameter *cargo* (find-exe "cargo"))
    1.14+
    1.15+(defun run-cargo (&rest args)
    1.16+  (let ((proc (sb-ext:run-program *cargo* (or args nil) :output :stream)))
    1.17+    (with-open-stream (s (sb-ext:process-output proc))
    1.18+      (loop for l = (read-line s nil nil)
    1.19+            while l
    1.20+            do (write-line l)))
    1.21+    (if (eq 0 (sb-ext:process-exit-code proc))
    1.22+        nil
    1.23+        (cargo-error "CARGO command failed: ~A ~A" *cargo* (or args "")))))
     2.1--- a/lisp/lib/cli/tools/pkg.lisp	Mon Aug 12 21:44:58 2024 -0400
     2.2+++ b/lisp/lib/cli/tools/pkg.lisp	Mon Aug 12 21:47:02 2024 -0400
     2.3@@ -45,7 +45,10 @@
     2.4 
     2.5 (defpackage :cli/tools/cargo
     2.6   (:use :cl :std :cli/env)
     2.7-  (:export))
     2.8+  (:export
     2.9+   #:cargo-error
    2.10+   #:*cargo*
    2.11+   #:run-cargo))
    2.12 
    2.13 (defpackage :cli/tools/sbcl
    2.14   (:use :cl :std :cli/env)