-
Notifications
You must be signed in to change notification settings - Fork 697
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
Allow executables to also be scripts #10324
Comments
If I change the main module in the package, effectively removing the script I want to run from the package, then I can run it: $ git diff
diff --git a/cabal-validate/cabal-validate.cabal b/cabal-validate/cabal-validate.cabal
index 37a6f5263..1f0e0465a 100644
--- a/cabal-validate/cabal-validate.cabal
+++ b/cabal-validate/cabal-validate.cabal
@@ -14,15 +14,9 @@ common warnings
executable cabal-validate
import: warnings
default-language: Haskell2010
- default-extensions:
- OverloadedStrings
- , NoFieldSelectors
- , DuplicateRecordFields
- , OverloadedRecordDot
- , TypeApplications
ghc-options: -O -threaded -rtsopts -with-rtsopts=-N
- main-is: Main.hs
+ main-is: Non-Existant-Main.hs
hs-source-dirs: main
build-depends:
diff --git a/cabal-validate/main/Main.hs b/cabal-validate/main/Main.hs
old mode 100644
new mode 100755
index 6f2847819..1026103b7
--- a/cabal-validate/main/Main.hs
+++ b/cabal-validate/main/Main.hs
@@ -1,4 +1,22 @@
-module Main where
+#!/usr/bin/env cabal
+{- cabal:
+build-depends:
+ base >=4 && <5
+ , ansi-terminal >=1 && <2
+ , turtle >=1 && <2
+ , optparse-applicative >=0.18 && <1
+ , containers >=0.6 && <1
+ , directory >=1.0 && <2
+ , text >=2 && <3
+ , terminal-size >=0.3 && <1
+ , time >=1 && <2
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE OverloadedRecordDot #-}
+{-# LANGUAGE TypeApplications #-}
import Control.Applicative (Alternative (many, (<|>)), (<**>))
import Control.Monad (forM_, unless)
|
This was referenced Sep 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally posted by @philderbeast in #10317 (comment)
Please allow at least single file, self contained executables to be run as scripts. I tried this with #10320 but was rebuffed with:
The text was updated successfully, but these errors were encountered: