packages feed

encapsule 0.5 → 0.5.1

raw patch · 7 files changed

+32/−11 lines, 7 files

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # encapsule releases +## 0.5.1 (2026-09-15)+- `enter` bugfix: -e=LANG must precede container+- `enter`: allow an optional command like `run` (`enter TOOLBOX -- tmux`)+ ## 0.5 (2026-09-14) - `run`,`create`: now always act on a container image - `run`,`create`: set `--workdir` only when the path exists at start
README.md view
@@ -27,7 +27,7 @@ `$ encapsule --version`  ```-0.5+0.5.1 ```  `$ encapsule --help`@@ -53,7 +53,7 @@   backup                   Create a tarball backup of a directory   commit                   Commit an encapsule image from a container   create                   Create an encapsule container-  enter                    Connect to a encapsule container+  enter                    Connect to an encapsule container   run                      Run a temporary encapsule container ``` @@ -113,6 +113,11 @@  ### `enter` command `enter` is used to join an existing (typically running) encapsule container.+An optional command can be given, as with `run`:++```bash+$ encapsule enter my-toolbox -- tmux+```  ### `commit` command `commit` saves a container as an encapsule image (`encapsule-CONTAINER` by default).
encapsule.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                encapsule-version:             0.5+version:             0.5.1 synopsis:            Run isolated toolbox containers with podman description:         This tool (originally based on the toolbox-constrained project)
example/config.toml view
@@ -24,3 +24,7 @@  [capabilities.isolation] volumes = ["~/isolation:~:rw"]++[capabilities.ssh-agent]+env = ["XDG_RUNTIME_DIR"]+volumes = ["$XDG_RUNTIME_DIR/ssh-agent.sock"]
src/Enter.hs view
@@ -39,9 +39,10 @@           d -> d       homeEnv =         if isNothing mPasswdHome then ["env", "HOME=" ++ homeDir] else []-      execArgs = ["exec", "-it", "--user", username,-                  "--workdir", workdir, container]-                 ++ langEnvArgs ++ homeEnv ++ userCmd+      execArgs = ["exec", "-it", "--user", username]+                 ++ langEnvArgs+                 ++ ["--workdir", workdir, container]+                 ++ homeEnv ++ userCmd   when (dryrun || debug) $     putStrLn $ unwords ("podman" : map shellQuote execArgs)   unless dryrun $ do
src/Main.hs view
@@ -53,13 +53,14 @@       <*> strArg "TOOLBOX"     , Subcommand "create" "Create an encapsule container" $       runCmd <$> runOpts True False-    , Subcommand "enter" "Connect to a encapsule container" $+    , Subcommand "enter" "Connect to an encapsule container" $       enterCmd       <$> dryrunOpt       <*> debugOpt       <*> pure True       <*> optional (strArg "TOOLBOX")       <*> optional projectNameOpt+      <*> many (strArg "[--] CMD")     , Subcommand "run" "Run a temporary encapsule container" $       runCmd <$> runOpts False True     ]@@ -155,8 +156,9 @@       cmd_ "podman" ["stop", containerName]     else warning $ "container" +-+ containerName +-+ "not found" -enterCmd :: Bool -> Bool -> Bool -> Maybe String -> Maybe ProjectName -> IO ()-enterCmd dryrun debug running mbase mprojectname = do+enterCmd :: Bool -> Bool -> Bool -> Maybe String -> Maybe ProjectName+         -> [String] -> IO ()+enterCmd dryrun debug running mbase mprojectname command = do   regexp <-     case mprojectname of       Nothing -> return $ progname +=+ fromMaybe "" mbase@@ -173,12 +175,12 @@     [] ->       if running       then do-        enterCmd dryrun debug False mbase mprojectname+        enterCmd dryrun debug False mbase mprojectname command       else error' "encapsule container not found"     [c] -> do       unless running $         warning "no running encapsule container found"-      enterContainer dryrun debug True c []+      enterContainer dryrun debug True c command     _ -> error' $ "multiple" +-+ (if running then  "running" else "") +-+ "containers match:\n" ++ unlines ps  -- image management
test/Spec.hs view
@@ -174,6 +174,11 @@               "debug sudo line for " ++ img ++ " (got: " ++               show other ++ ")" +  describe "enter" $ do+    it "offers an optional command" $ do+      out <- encapsule ["enter", "--help"]+      out `shouldContain` "[--] CMD"+   describe "commit" $ do     it "offers --name" $ do       out <- encapsule ["commit", "--help"]