look at LEDGER_FILE for the journal path, otherwise LEDGER, like c++ ledger
This commit is contained in:
		
							parent
							
								
									505d677461
								
							
						
					
					
						commit
						eefae63bb6
					
				@ -107,14 +107,15 @@ Basic usage is:
 | 
				
			|||||||
    $ hledger [OPTIONS] COMMAND [FILTER PATTERNS]
 | 
					    $ hledger [OPTIONS] COMMAND [FILTER PATTERNS]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hledger first looks for data in a specially-formatted
 | 
					hledger first looks for data in a specially-formatted
 | 
				
			||||||
[journal file](#file-format).  You can specify the file with the -f
 | 
					[journal file](#file-format).  You can specify the file with the `-f`
 | 
				
			||||||
option or the `LEDGER` environment variable; otherwise hledger assumes it
 | 
					option or the `LEDGER_FILE` environment variable (`LEDGER` is also
 | 
				
			||||||
is a file named `.journal` in your home directory. If the journal file
 | 
					supported for backwards compatibility); otherwise hledger assumes it is a
 | 
				
			||||||
 | 
					file named `.hledger.journal` in your home directory. If the journal file
 | 
				
			||||||
does not exist, it will be auto-created.
 | 
					does not exist, it will be auto-created.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To get started, save this
 | 
					To get started, save this
 | 
				
			||||||
[sample file](http://joyful.com/repos/hledger/data/sample.journal) as
 | 
					[sample file](http://joyful.com/repos/hledger/data/sample.journal) as
 | 
				
			||||||
`.journal` in your home directory, or just run `hledger add` and enter
 | 
					`.hledger.journal` in your home directory, or just run `hledger add` and enter
 | 
				
			||||||
some transactions. Now try commands like these:
 | 
					some transactions. Now try commands like these:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $ hledger add                           # add some new transactions to the journal file
 | 
					    $ hledger add                           # add some new transactions to the journal file
 | 
				
			||||||
 | 
				
			|||||||
@ -38,8 +38,9 @@ import System.IO (hGetContents)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
journalenvvar           = "LEDGER"
 | 
					journalenvvar           = "LEDGER_FILE"
 | 
				
			||||||
timelogenvvar          = "TIMELOG"
 | 
					journalenvvar2          = "LEDGER"
 | 
				
			||||||
 | 
					timelogenvvar           = "TIMELOG"
 | 
				
			||||||
journaldefaultfilename  = ".journal"
 | 
					journaldefaultfilename  = ".journal"
 | 
				
			||||||
timelogdefaultfilename = ".timelog"
 | 
					timelogdefaultfilename = ".timelog"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -111,13 +112,19 @@ emptyJournal = do
 | 
				
			|||||||
readJournal :: Maybe String -> String -> IO (Either String Journal)
 | 
					readJournal :: Maybe String -> String -> IO (Either String Journal)
 | 
				
			||||||
readJournal format s = journalFromPathAndString format "(string)" s
 | 
					readJournal format s = journalFromPathAndString format "(string)" s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | Get the user's default journal file path.
 | 
					-- | Get the user's default journal file path. Like ledger, we look first
 | 
				
			||||||
 | 
					-- for the LEDGER_FILE environment variable, and if that does not exist,
 | 
				
			||||||
 | 
					-- for the legacy LEDGER environment variable. If neither exists, the path
 | 
				
			||||||
 | 
					-- will be ".hledger.journal" in the users's home directory, or if we
 | 
				
			||||||
 | 
					-- cannot determine that, in the current directory.
 | 
				
			||||||
myJournalPath :: IO String
 | 
					myJournalPath :: IO String
 | 
				
			||||||
myJournalPath =
 | 
					myJournalPath =
 | 
				
			||||||
    getEnv journalenvvar `catch`
 | 
					    getEnv journalenvvar `catch`
 | 
				
			||||||
               (\_ -> do
 | 
					               (\_ -> do
 | 
				
			||||||
                  home <- getHomeDirectory `catch` (\_ -> return "")
 | 
					                  getEnv journalenvvar2 `catch`
 | 
				
			||||||
                  return $ home </> journaldefaultfilename)
 | 
					                             (\_ -> do
 | 
				
			||||||
 | 
					                                home <- getHomeDirectory `catch` (\_ -> return "")
 | 
				
			||||||
 | 
					                                return $ home </> journaldefaultfilename))
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
-- | Get the user's default timelog file path.
 | 
					-- | Get the user's default timelog file path.
 | 
				
			||||||
myTimelogPath :: IO String
 | 
					myTimelogPath :: IO String
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user