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
20 import Darcs
.TheCommands
24 main
= man
(extract_commands command_control_list
)
26 man
:: [DarcsCommand
] -> IO ()
27 man cs
= do man_header
28 unorganized
<- man_organizer cs
29 putStrLn ".SH OTHER COMMANDS"
30 man_helper unorganized
33 man_organizer
:: [DarcsCommand
] -> IO [DarcsCommand
]
34 man_organizer commands
= mo commands
35 [("CREATING REPOSITORIES",
36 ["initialize","get"]),
37 ("MODIFYING REPOSITORY CONTENTS",
38 ["add","remove","mv","replace"]),
39 ("WORKING WITH CHANGES",
40 ["record","pull","push","send","apply"]),
41 ("SEEING WHAT YOU'VE DONE",
44 where mo
:: [DarcsCommand
] -> [(String,[String])] -> IO [DarcsCommand
]
47 do putStrLn $ ".SH " ++ t
48 man_helper
$ filter ((`
elem` a
) . command_name
) cs
49 mo
(filter (not . (`
elem` a
) . command_name
) cs
) xs
51 man_helper
:: [DarcsCommand
] -> IO ()
54 where helper
' _
[] = return ()
55 helper
' s
(c
@DarcsCommand
{ }:cs
) = do
57 putStrLn $ ".B "++ s
++ " " ++ command_name c
58 putStrLn $ command_help c
60 helper
' s
(c
@SuperCommand
{ }:cs
) = do
61 helper
' (command_name c
++ " " ++ s
)
62 (extract_commands
(command_sub_commands c
))
66 man_trailer
= do putStrLn ""
68 putStrLn "Report bugs by mail to"
69 putStrLn ".B bugs@darcs.net"
70 putStrLn "or via the web site at"
71 putStrLn ".BR http://bugs.darcs.net/ ."
74 putStrLn "David Roundy <droundy@abridgegame.org>."
78 putStr ".TH DARCS \"1\" \""
80 ct
<- toCalendarTime cl
81 putStr $ show (ctMonth ct
) ++ " " ++ show (ctYear ct
)
82 putStr "\" \"darcs\" \"User Commands\"\n"
85 "darcs \\- an advanced revision control system\n"++
88 "\\fICOMMAND \\fR...\n"++
91 "darcs is a nifty revision control tool. For more a detailed description,\n"++
92 "see the html documentation, which should be available at\n"++
93 "/usr/share/doc/darcs/manual/index.html. To easily get more specific help\n"++
94 "on each command, you can call `darcs COMMAND --help'.\n"++