mirror of
https://gitlab.com/vindarel/ciel.git
synced 2026-01-30 20:33:32 -08:00
move nicknames to ciel-user, add one for os/filesystem
This commit is contained in:
parent
c0ee6f5921
commit
2804f115d0
3 changed files with 50 additions and 14 deletions
|
|
@ -380,9 +380,45 @@ And for a tutorial, see <https://lispcookbook.github.io/cl-cookbook/databases.ht
|
|||
|
||||
## Files and directories
|
||||
|
||||
CL has built-in functions to deal with files and directories and UIOP provides more. See [https://lispcookbook.github.io/cl-cookbook/files.html](https://lispcookbook.github.io/cl-cookbook/files.html).
|
||||
CL has built-in functions to deal with files and directories, and UIOP provides more. See [https://lispcookbook.github.io/cl-cookbook/files.html](https://lispcookbook.github.io/cl-cookbook/files.html).
|
||||
|
||||
See also some functions under `uiop/os` (or simply `uiop` or `os` for short) like `os:getcwd`.
|
||||
See some functions under `uiop`, especially under `uiop/filesystem` (`filesystem` for short) like `filesystem:file-exists-p`, and some more under `uiop/os` (or just `os`) like `os:getcwd`.
|
||||
|
||||
Example functions (not exhaustive):
|
||||
|
||||
```
|
||||
filesystem:call-with-current-directory
|
||||
filesystem:collect-sub*directories
|
||||
filesystem:delete-directory-tree
|
||||
filesystem:delete-empty-directory
|
||||
filesystem:delete-file-if-exists
|
||||
filesystem:directory*
|
||||
filesystem:directory-exists-p
|
||||
filesystem:directory-files
|
||||
filesystem:ensure-all-directories-exist
|
||||
filesystem:file-exists-p
|
||||
filesystem:filter-logical-directory-results
|
||||
filesystem:get-pathname-defaults
|
||||
filesystem:getenv-absolute-directories
|
||||
filesystem:getenv-absolute-directory
|
||||
filesystem:getenv-pathname
|
||||
filesystem:getenv-pathnames
|
||||
filesystem:inter-directory-separator
|
||||
filesystem:lisp-implementation-directory
|
||||
filesystem:lisp-implementation-pathname-p
|
||||
filesystem:native-namestring
|
||||
filesystem:parse-native-namestring
|
||||
filesystem:probe-file*
|
||||
filesystem:rename-file-overwriting-target
|
||||
filesystem:resolve-symlinks
|
||||
filesystem:resolve-symlinks*
|
||||
filesystem:safe-file-write-date
|
||||
filesystem:split-native-pathnames-string
|
||||
filesystem:subdirectories
|
||||
filesystem:truename*
|
||||
filesystem:truenamize
|
||||
filesystem:with-current-directory
|
||||
```
|
||||
|
||||
We include the [FOF (File-object finder)](https://gitlab.com/ambrevar/fof/) library, which is very useful to:
|
||||
|
||||
|
|
@ -398,7 +434,6 @@ In practice, it mostly supersedes:
|
|||
- Common Lisp pathnames (at least for existing files).
|
||||
- Many Unix tools:
|
||||
- `find` for recursive and programmable file search. Unlike `find`, `finder`'s predicates are extensible.
|
||||
- `ls`
|
||||
- `stat`
|
||||
- `chown`
|
||||
- `chmod`
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ An example script:
|
|||
(cmd:cmd "ls")
|
||||
|
||||
;; Access environment variables:
|
||||
(hello (uiop:getenv "USER"))
|
||||
(hello (os:getenv "USER")) ;; os is a nickname for uiop/os
|
||||
|
||||
(format! t "Let's define an alias to run shell commands with '!'. This gives: ")
|
||||
(defalias ! #'cmd:cmd)
|
||||
|
|
|
|||
|
|
@ -3,19 +3,20 @@
|
|||
(uiop:define-package ciel
|
||||
(:use :cl)
|
||||
(:export #:enable-shell-passthrough
|
||||
#:-->)
|
||||
(:local-nicknames (:/os :uiop/os)
|
||||
;; let's try this nickname.
|
||||
;; Simply :os doesn't help at auto-discovery with SLIME's autocompletion.
|
||||
;; but let's add it anyways for correctness.
|
||||
(:os :uiop/os)
|
||||
(:alex :alexandria)
|
||||
(:csv :cl-csv)
|
||||
(:http :dexador)))
|
||||
#:-->))
|
||||
|
||||
(uiop:define-package ciel-user
|
||||
(:use :cl :ciel)
|
||||
(:local-nicknames (:csv :cl-csv)
|
||||
(:local-nicknames (:/os :uiop/os) ; let's try this nickname.
|
||||
;; Simply :os doesn't help at auto-discovery with SLIME's autocompletion.
|
||||
;; But let's add it anyways for correctness,
|
||||
;; it's handy for the shell and scripts.
|
||||
(:os :uiop/os)
|
||||
;; This other uiop module is always useful:
|
||||
(:filesystem :uiop/filesystem)
|
||||
|
||||
(:alex :alexandria)
|
||||
(:csv :cl-csv)
|
||||
(:http :dexador)
|
||||
(:json :shasht)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue