1 -- Copyright (C) 2003 David Roundy
3 -- This program is free software; you can redistribute it and/or modify
4 -- it under the terms of the GNU General Public License as published by
5 -- the Free Software Foundation; either version 2, or (at your option)
8 -- This program is distributed in the hope that it will be useful,
9 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
10 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 -- GNU General Public License for more details.
13 -- You should have received a copy of the GNU General Public License
14 -- along with this program; if not, write to the Free Software Foundation,
15 -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 module Main
(main
) where
19 import Autoconf
( datadir
)
21 import Darcs
.TheCommands
25 main
= man
(extract_commands command_control_list
)
27 man
:: [DarcsCommand
] -> IO ()
28 man cs
= do man_header
29 unorganized
<- man_organizer cs
30 putStrLn ".SH OTHER COMMANDS"
31 man_helper unorganized
34 man_organizer
:: [DarcsCommand
] -> IO [DarcsCommand
]
35 man_organizer commands
= mo commands
36 [("CREATING REPOSITORIES",
37 ["initialize","get"]),
38 ("MODIFYING REPOSITORY CONTENTS",
39 ["add","remove","mv","replace"]),
40 ("WORKING WITH CHANGES",
41 ["record","pull","push","send","apply"]),
42 ("SEEING WHAT YOU'VE DONE",
45 where mo
:: [DarcsCommand
] -> [(String,[String])] -> IO [DarcsCommand
]
48 do putStrLn $ ".SH " ++ t
49 man_helper
$ filter ((`
elem` a
) . command_name
) cs
50 mo
(filter (not . (`
elem` a
) . command_name
) cs
) xs
52 man_helper
:: [DarcsCommand
] -> IO ()
55 where helper
' _
[] = return ()
56 helper
' s
(c
@DarcsCommand
{ }:cs
) = do
58 putStrLn $ ".B "++ s
++ " " ++ command_name c
59 putStrLn $ command_help c
61 helper
' s
(c
@SuperCommand
{ }:cs
) = do
62 helper
' (command_name c
++ " " ++ s
)
63 (extract_commands
(command_sub_commands c
))
67 man_trailer
= do putStrLn ""
69 putStrLn "Report bugs by mail to"
70 putStrLn ".B bugs@darcs.net"
71 putStrLn "or via the web site at"
72 putStrLn ".BR http://bugs.darcs.net/ ."
75 putStrLn "David Roundy <droundy@abridgegame.org>."
79 putStr ".TH DARCS \"1\" \""
81 ct
<- toCalendarTime cl
82 putStr $ show (ctMonth ct
) ++ " " ++ show (ctYear ct
)
83 putStr "\" \"darcs\" \"User Commands\"\n"
86 "darcs \\- an advanced revision control system\n"++
89 "\\fICOMMAND \\fR...\n"++
92 "darcs is a nifty revision control tool. For more a detailed description,\n"++
93 "see the html documentation, which should be available at\n"++
94 datadir
++"/doc/darcs/manual/index.html. To easily get more specific help\n"++
95 "on each command, you can call `darcs COMMAND --help'\n"++