simplify config flag display
This commit is contained in:
		
							parent
							
								
									8dcd53c9ba
								
							
						
					
					
						commit
						56c99bdfd6
					
				
							
								
								
									
										26
									
								
								Options.hs
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								Options.hs
									
									
									
									
									
								
							@ -13,32 +13,18 @@ import Ledger.Dates
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
configflags = [
 | 
					configflags = [
 | 
				
			||||||
         ("vty",
 | 
					 | 
				
			||||||
#ifdef VTY
 | 
					#ifdef VTY
 | 
				
			||||||
          True
 | 
					  "vty"
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
          False
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
         )
 | 
					 | 
				
			||||||
        ,("ansi",
 | 
					 | 
				
			||||||
#ifdef ANSI
 | 
					#ifdef ANSI
 | 
				
			||||||
          True
 | 
					 ,"ansi"
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
          False
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
         )
 | 
					 ]
 | 
				
			||||||
         ]
 | 
					 | 
				
			||||||
versionmsg  = "hledger " ++ version ++ configmsg ++ "\n"
 | 
					versionmsg  = "hledger " ++ version ++ configmsg ++ "\n"
 | 
				
			||||||
version     = "0.3.x"
 | 
					version     = "0.3.x"
 | 
				
			||||||
configmsg
 | 
					configmsg = if null configflags
 | 
				
			||||||
    | null with && null without = ""
 | 
					            then ""
 | 
				
			||||||
    | (not $ null with) && (not $ null without) = " configured" ++ with ++ " and" ++ without
 | 
					            else " with " ++ intercalate ", " configflags
 | 
				
			||||||
    | otherwise = " configured" ++ with ++ without
 | 
					 | 
				
			||||||
    where
 | 
					 | 
				
			||||||
      with = punc "with" [f | (f,v) <- configflags, v]
 | 
					 | 
				
			||||||
      without = punc "without" [f | (f,v) <- configflags, not v]
 | 
					 | 
				
			||||||
      punc _ [] = ""
 | 
					 | 
				
			||||||
      punc prefix ws = printf " %s %s" prefix (intercalate ", " ws)
 | 
					 | 
				
			||||||
ledgerdefault  = "~/.ledger"
 | 
					ledgerdefault  = "~/.ledger"
 | 
				
			||||||
ledgerenvvar   = "LEDGER"
 | 
					ledgerenvvar   = "LEDGER"
 | 
				
			||||||
timelogdefault = "~/.timelog"
 | 
					timelogdefault = "~/.timelog"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user