Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gxpkg new command #846

Merged
merged 15 commits into from
Sep 14, 2023
Merged

gxpkg new command #846

merged 15 commits into from
Sep 14, 2023

Conversation

vyzo
Copy link
Collaborator

@vyzo vyzo commented Sep 14, 2023

Implements gerbil new as a synonym for gxpkg new; this creates a new package template in the current directory.

@vyzo vyzo requested a review from ober September 14, 2023 09:46
@vyzo vyzo mentioned this pull request Sep 14, 2023
5 tasks
@vyzo
Copy link
Collaborator Author

vyzo commented Sep 14, 2023

DEMO

$ cd /tmp
vyzo@dellicious:/tmp$ gerbil help new
Usage: gxpkg new [command-option ...]
       Create a new package template in the current directory

Command Options:
 -p --package <package>           The package prefix for your project; defaults to the current username [default: vyzo]
 -n --name <name>                 The package name; defaults to the current directory name [default: tmp]
 -l --link <link>                 Optionally link this package with a public package name; for example: github.com/your-user/your-package [default: #f]
vyzo@dellicious:/tmp$ mkdir hello
vyzo@dellicious:/tmp$ cd hello
vyzo@dellicious:/tmp/hello$ gerbil new
vyzo@dellicious:/tmp/hello$ ls -tra
..  hello  .gitignore  gerbil.pkg  build.ss  .
vyzo@dellicious:/tmp/hello$ ls hello/
lib.ss  main.ss
vyzo@dellicious:/tmp/hello$ cat hello/main.ss 
;;; -*- Gerbil -*-
(import :std/sugar
        :std/getopt
        ./lib)
(export main)

(def (main . args)
  (call-with-getopt hello-main args
    program: "hello"
    help: "A one line description of your program"
    ;; commands/options/flags for your program; see :std/getopt
    ;; ...
    ))

(def* hello-main
  ((opt)
   (hello-main/options opt))
  ((cmd opt)
   (hello-main/command cmd opt)))

;;; Implement this if your CLI doesn't have commands
(def (hello-main/options opt)
  (error "Implement me!"))

;;; Implement this if your CLI has commands
(def (hello-main/command cmd opt)
  (error "Implement me!"))
vyzo@dellicious:/tmp/hello$ gerbil build
... build in current directory
... compile hello/lib
... compile hello/main
... compile exe hello/main -> ~/.gerbil/bin/hello
/tmp/gxc.1694694255.2991974/vyzo__hello__main.scm:
/home/vyzo/.gerbil/bin/hello.scmx:
/tmp/gxc.1694694255.2991974/vyzo__hello__main.c:
/home/vyzo/.gerbil/bin/hello.c:
/home/vyzo/.gerbil/bin/hello_.c:
vyzo@dellicious:/tmp/hello$ hello
*** ERROR -- Implement me!
vyzo@dellicious:/tmp/hello$ 

Copy link
Collaborator

@ober ober left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ober ober merged commit fba4fc7 into master Sep 14, 2023
@ober ober deleted the gxpkg-new branch September 14, 2023 14:52
@vyzo vyzo added this to the Gerbil v0.18: Nimzowitsch milestone Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants