Skip to content

A peer-to-peer stack for code collaboration

Improve XDG files

Thomas Scholtes2b29023b8c68
diff --git a/exe/Repl/Main.hs b/exe/Repl/Main.hs
index f9881d8..053a6af 100644
--- a/exe/Repl/Main.hs
+++ b/exe/Repl/Main.hs
@@ -9,11 +9,11 @@ main :: IO ()
main = do
opts' <- execParser allOpts
cfgFile <- case configFile opts' of
- Nothing -> getConfig
+ Nothing -> getConfigFile
Just cfg -> pure cfg
cfgSrc <- readFile cfgFile
hist <- case histFile opts' of
- Nothing -> getHistory
+ Nothing -> getHistoryFile
Just h -> pure h
repl (Just hist) (toS cfgFile) cfgSrc replBindings
where
diff --git a/exe/Server/Client.hs b/exe/Server/Client.hs
index 74339eb..1ec5e7c 100644
--- a/exe/Server/Client.hs
+++ b/exe/Server/Client.hs
@@ -15,11 +15,11 @@ main :: IO ()
main = do
opts' <- execParser allOpts
cfgFile <- case configFile opts' of
- Nothing -> getConfig
+ Nothing -> getConfigFile
Just cfg -> pure cfg
cfgSrc <- readFile cfgFile
hist <- case histFile opts' of
- Nothing -> getHistory
+ Nothing -> getHistoryFile
Just h -> pure h
mgr <- newManager defaultManagerSettings
let cEnv = mkClientEnv mgr (serverURL opts')
diff --git a/src/Radicle.hs b/src/Radicle.hs
index 2218227..59b7220 100644
--- a/src/Radicle.hs
+++ b/src/Radicle.hs
@@ -82,8 +82,8 @@ module Radicle
, ReplM
-- * CLI
- , getConfig
- , getHistory
+ , getConfigFile
+ , getHistoryFile
-- * Helpers
, quote
diff --git a/src/Radicle/Internal/CLI.hs b/src/Radicle/Internal/CLI.hs
index 4ec4a2b..f104242 100644
--- a/src/Radicle/Internal/CLI.hs
+++ b/src/Radicle/Internal/CLI.hs
@@ -1,6 +1,6 @@
module Radicle.Internal.CLI
- ( getConfig
- , getHistory
+ ( getConfigFile
+ , getHistoryFile
)
where
@@ -8,9 +8,18 @@ import Protolude
import System.Directory (XdgDirectory(..), getXdgDirectory)
-- | Uses XDG_CONFIG_HOME if available.
-getConfig :: IO FilePath
-getConfig = getXdgDirectory XdgConfig "rad/config.rad"
+-- | Location of the default radicle file to interpretradicle history.
+-- Usually @~/.local/config/radicle/config.rad@.
+--
+-- See 'getXdgDirectory' XdgConfig' for how @~/.local/share@ is
+-- determined.
+getConfigFile :: IO FilePath
+getConfigFile = getXdgDirectory XdgConfig "radicle/config.rad"
--- | Uses XDG_CACHE_HOME if available.
-getHistory :: IO FilePath
-getHistory = getXdgDirectory XdgData "rad/config.rad"
+-- | Location of the radicle history. Usually
+-- @~/.local/share/radicle/history@.
+--
+-- See 'getXdgDirectory' 'XdgData' for how @~/.local/share@ is
+-- determined.
+getHistoryFile :: IO FilePath
+getHistoryFile = getXdgDirectory XdgData "radicle/history"