Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add --version option that prints Cask's version.

  • Loading branch information...
commit 2ec35c8527d9d6fedf1eb6f7e672a4f68580cf0e 1 parent a0fefb0
@rejeep rejeep authored
View
12 cask-cli.el
@@ -205,6 +205,17 @@
(defun cask-cli/set-path (path)
(setq cask-cli--path path))
+(defun cask-cli/cask-version ()
+ "Print Cask's version.
+
+This function prints Cask's version on the format:
+'vMAJOR.MINOR.PATCH'."
+ (let* ((package (epl-package-from-lisp-file (f-expand "cask.el" cask-directory)))
+ (version (epl-package-version-string package)))
+ (princ version)
+ (princ "\n"))
+ (kill-emacs 0))
+
(commander
(name "cask")
(description "Emacs dependency management made easy")
@@ -226,6 +237,7 @@
(command "package-directory" "Print package installation directory" cask-cli/package-directory)
(command "outdated" "Show list of outdated packages" cask-cli/outdated)
+ (option "--version" "Print Casks's version" cask-cli/cask-version)
(option "-h, --help" "Display this help message" cask-cli/help)
(option "--dev" "Run in dev mode" cask-cli/dev)
(option "--debug" "Turn on debug output" cask-cli/debug)
View
9 features/cask-version.feature
@@ -0,0 +1,9 @@
+Feature: Cask version
+
+ Background:
+ Given I create a project called "cask-version"
+ And I go to the project called "cask-version"
+
+ Scenario: Version
+ When I run cask "--version"
+ Then I should see cask version
View
4 features/step-definitions/cask-steps.el
@@ -141,6 +141,10 @@
(let ((default-directory cask-current-project))
(f-move (cask-test/template from) (cask-test/template to)))))
+(Then "^I should see cask version$"
+ (lambda ()
+ (should (s-matches? "^[0-9]+\.[0-9]+\.[0-9]+\n$" cask-output))))
+
(provide 'cask-steps)
;;; cask-steps.el ends here
Please sign in to comment.
Something went wrong with that request. Please try again.