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