sloth/scripts/sloth.in

62 lines
1.5 KiB
Plaintext

#!@GUILE@ \
--no-auto-compile -e main -s
!#
;; bin/sloth --- sloth text editor -*- coding: utf-8 -*-
;;; Commentary:
;;;
;;; This is the entry file for sloth.
;;;
;;; Code:
(use-modules (config)
(config api)
(config licenses)
(config parser sexp)
(ice-9 exceptions)
(sloth common)
(sloth editor)
(sloth interface)
(ncurses curses))
;; Commandline handling
(define %configuration
(configuration
(name 'sloth)
(version @HVERSION@)
(author @AUTHOR@)
(copyright @COPYRIGHT@)
(license @LICENSE@)
(synopsis "Text editor based on tree-sitter")
(description
"TODO")
(arguments
(list
(argument (name 'file)
(default "")
(test string?)
(synopsis "The file to open")
(example "./file.txt"))))
(directory (in-home ".config/"))
(parser simple-sexp-parser)
(generate-cmdtree? #t)))
(define (main args)
"(Listof String) -> Int
program entrypoint; handle commandline args and call appropriate procedures"
(define options (getopt-config-auto args %configuration))
(define frontend (init-frontend 'ncurses))
(with-exception-handler
(lambda (err)
(when (error? err)
(end frontend)
(format (current-error-port) "An error occurred: ~a" err)))
(lambda ()
(start-loop frontend (option-ref options '(file) #f)))))
;;; Local Variables:
;;; mode: scheme
;;; End: