graft

simple package manager
git clone git://git.rr3.xyz/graft | git clone gits://git.rr3.xyz/graft
Log | Files | Refs | README | LICENSE

README (4847B)


      1 GRAFT(1)                          User Commands                         GRAFT(1)
      2 
      3 NAME
      4        graft - simple "package manager"
      5 
      6 SYNOPSIS
      7        graft [-hn] ROOT PKGS...
      8 
      9 DESCRIPTION
     10        graft is a simple "package manager" that merely links or copies
     11        files/directories into place and then prints what happened.
     12 
     13        graft does not handle remote fetching, build steps, versions,
     14        dependencies, package removal, or most other features you would expect
     15        from a "package manager" (hence the scare quotes).
     16 
     17 OPTIONS
     18        -h     Display a help message.
     19 
     20        -n     Enable dry-run mode, causing graft to not write any files but
     21               still print-out what it would do. (More precisely, this only
     22               affects the link and copy functions. .graft.sh scripts can still
     23               do anything.)
     24 
     25 NOTES
     26        graft is mainly intended for configuration file ("dotfile") management.
     27 
     28 EXAMPLE
     29        $ tree -a --noreport example-pkg
     30        example-pkg
     31        ├── .graft.sh
     32        ├── a
     33        │   ├── 0.txt
     34        │   ├── 1.txt
     35        │   └── 2.txt
     36        ├── b
     37        │   ├── 0.txt
     38        │   ├── 1.txt
     39        │   └── 2.txt
     40        ├── bar.txt
     41        └── foo.txt
     42 
     43        $ cat example-pkg/.graft.sh
     44        # Print messages during install:
     45        msg_note "This is an important note (e.g., make sure you manually do this thing)"
     46        msg_info "This is information"
     47        msg_warning "This is a warning"
     48        msg_error "This is an error (not fatal)"
     49        # msg_fatal "This is an error (fatal)"
     50 
     51        # Link files/directories:
     52        link foo.txt
     53        link a-link a
     54        for f in b/*; do
     55             link b-links/"$(basename "$f")" "$f"
     56        done
     57 
     58        # Copy files/directories:
     59        copy bar.txt
     60        copy a-copy a
     61        for f in b/*; do
     62             copy b-copies/"$(basename "$f")" "$f"
     63        done
     64 
     65        $ graft example-root example-pkg
     66        [example-pkg] NOTE: This is an important note (e.g., make sure you manually do this thing)
     67        [example-pkg] INFO: This is information
     68        [example-pkg] WARNING: This is a warning
     69        [example-pkg] ERROR: This is an error (not fatal)
     70        [example-pkg] LINK CREATE: /<omitted>/example-root/foo.txt --> foo.txt
     71        [example-pkg] LINK CREATE: /<omitted>/example-root/a-link --> a
     72        [example-pkg] LINK CREATE: /<omitted>/example-root/b-links/0.txt --> b/0.txt
     73        [example-pkg] LINK CREATE: /<omitted>/example-root/b-links/1.txt --> b/1.txt
     74        [example-pkg] LINK CREATE: /<omitted>/example-root/b-links/2.txt --> b/2.txt
     75        [example-pkg] COPY CREATE: /<omitted>/example-root/bar.txt <-- bar.txt
     76        [example-pkg] COPY CREATE: /<omitted>/example-root/a-copy <-- a
     77        [example-pkg] COPY CREATE: /<omitted>/example-root/b-copies/0.txt <-- b/0.txt
     78        [example-pkg] COPY CREATE: /<omitted>/example-root/b-copies/1.txt <-- b/1.txt
     79        [example-pkg] COPY CREATE: /<omitted>/example-root/b-copies/2.txt <-- b/2.txt
     80 
     81        $ tree -a --noreport example-root
     82        example-root
     83        ├── a-copy
     84        │   ├── 0.txt
     85        │   ├── 1.txt
     86        │   └── 2.txt
     87        ├── a-link -> /<omitted>/example-pkg/a
     88        ├── b-copies
     89        │   ├── 0.txt
     90        │   ├── 1.txt
     91        │   └── 2.txt
     92        ├── b-links
     93        │   ├── 0.txt -> /<omitted>/example-pkg/b/0.txt
     94        │   ├── 1.txt -> /<omitted>/example-pkg/b/1.txt
     95        │   └── 2.txt -> /<omitted>/example-pkg/b/2.txt
     96        ├── bar.txt
     97        └── foo.txt -> /<omitted>/example-pkg/foo.txt
     98 
     99        $ graft example-root example-pkg  # Idempotent
    100        [example-pkg] NOTE: This is an important note (e.g., make sure you manually do this thing)
    101        [example-pkg] INFO: This is information
    102        [example-pkg] WARNING: This is a warning
    103        [example-pkg] ERROR: This is an error (not fatal)
    104        [example-pkg] LINK OK: /<omitted>/example-root/foo.txt --> foo.txt
    105        [example-pkg] LINK OK: /<omitted>/example-root/a-link --> a
    106        [example-pkg] LINK OK: /<omitted>/example-root/b-links/0.txt --> b/0.txt
    107        [example-pkg] LINK OK: /<omitted>/example-root/b-links/1.txt --> b/1.txt
    108        [example-pkg] LINK OK: /<omitted>/example-root/b-links/2.txt --> b/2.txt
    109        [example-pkg] COPY OK: /<omitted>/example-root/bar.txt <-- bar.txt
    110        [example-pkg] COPY OK: /<omitted>/example-root/a-copy <-- a
    111        [example-pkg] COPY OK: /<omitted>/example-root/b-copies/0.txt <-- b/0.txt
    112        [example-pkg] COPY OK: /<omitted>/example-root/b-copies/1.txt <-- b/1.txt
    113        [example-pkg] COPY OK: /<omitted>/example-root/b-copies/2.txt <-- b/2.txt
    114 
    115 
    116 graft                              2026-07-26                           GRAFT(1)