123456789101112131415161718192021222324252627282930 |
- (commands pushd)
- ;; TODO: write to output port
- (define pushd
- (lambda* (#:optional
- (filename ".")
- #:key
- ;; command interface
- (previous-result '())
- (shell-state default-shell-state)
- (silent #f))
- "Change the current working directory, pushing the new working
- directory onto the directory stack."
- (let ([filename (if (null? previous-result)
- filename
- (car previous-result))])
- (receive (cd-result _) (cd filename #:silent #t)
- (let ([new-pwd (car cd-result)])
- (let* ([updated-dir-stack
- (cons new-pwd
- (get-shell-state shell-state 'directory-stack))]
- [updated-shell-state
- (update-shell-state* shell-state
- '(current-working-directory directory-stack)
- (list new-pwd updated-dir-stack))])
- (values updated-dir-stack
- updated-shell-state)))))))
- (alias push-directory pushd)
|