]> Cypherpunks.ru repositories - goredo.git/blob - usage.go
Fix workability under GNU/Linux and other systems because of different syscall
[goredo.git] / usage.go
1 /*
2 goredo -- redo implementation on pure Go
3 Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, version 3 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package main
19
20 import (
21         "flag"
22         "fmt"
23         "os"
24         "runtime"
25         "strings"
26 )
27
28 const (
29         Version  = "0.8.0"
30         Warranty = `This program is free software: you can redistribute it and/or modify
31 it under the terms of the GNU General Public License as published by
32 the Free Software Foundation, version 3 of the License.
33
34 This program is distributed in the hope that it will be useful,
35 but WITHOUT ANY WARRANTY; without even the implied warranty of
36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37 GNU General Public License for more details.
38
39 You should have received a copy of the GNU General Public License
40 along with this program.  If not, see <http://www.gnu.org/licenses/>.`
41 )
42
43 func versionGet() string {
44         return strings.Join([]string{
45                 "goredo", Version, "built with", runtime.Version(),
46         }, " ")
47 }
48
49 func usage() {
50         fmt.Fprintf(os.Stderr, versionGet()+`
51 Copyright (C) 2020-2021 Sergey Matveev
52 License GPLv3: GNU GPL version 3 <http://gnu.org/licenses/gpl.html>
53 This is free software: you are free to change and redistribute it.
54 There is NO WARRANTY, to the extent permitted by law.
55
56 redo, redo-{always,cleanup,dot,ifchange,ifcreate,log,stamp,whichdo} must
57 be linked to goredo executable. It determines the command by its own name.
58 You can create them by running: goredo -symlinks.
59
60 * redo [options] [target ...]
61   forcefully and *sequentially* build specified targets
62 * redo-always
63   always build current target. Unusable outside .do
64 * redo-cleanup {full,log,tmp} [...]
65   remove either all goredo's related temporary files, or kept stderr
66   logs, or everything (including .redo directories) related
67 * redo-dot target [...]
68   write dependency DOT graph to stdout
69 * redo-ifchange target [...]
70   build specified targets in parallel, if they are changed. Record them
71   as dependencies for current target
72 * redo-ifcreate target [...]
73   record ifcreate dependency for current target. Unusable outside .do
74 * redo-log target [ | tai64nlocal ]
75   display kept target's stderr with TAI64N timestamped lines. Only the
76   last build is kept. You must enable stderr keeping with either -logs,
77   or REDO_LOGS=1
78 * redo-stamp < [$3]
79   record stamp dependency for current target. Unusable outside .do.
80   Stamp dependency does not play any role, as all targets are hashed
81   anyway
82 * redo-whichdo target
83   display .do search paths for specified target. Exits successfully
84   if the last .do in output if the found existing one
85
86 Options:
87 `)
88         flag.PrintDefaults()
89         fmt.Fprintln(os.Stderr, `
90 Additional environment variables:
91   NO_COLOR -- disable messages colouring
92   REDO_NO_SYNC -- disable files/directories explicit filesystem syncing
93   REDO_TOP_DIR -- do not search for .do above that directory
94                   (it can contain .redo/top as an alternative)`)
95 }