summary refs log tree commit diff stats
path: root/TODO
Commit message (Expand)AuthorAgeFilesLines
* colorschemes: use "Scheme" as the default class name for colorschemeshut2010-02-281-0/+1
* todo: fixed non-unique bug IDhut2010-02-281-1/+1
* todo: finished #63: limit filesize in previewshut2010-02-251-1/+2
* finished #52, special characters in tab completionhut2010-02-241-1/+1
* console: fixed tabcompletion in openconsole starting with !xyz!hut2010-02-241-0/+1
* todo: bug #64 seems to have fixed itself magicallyhut2010-02-241-1/+1
* incremented version number and updated pydoc html files v1.0.3hut2010-02-161-8/+1
* ui: catching exception from curs_sethut2010-02-151-0/+2
* actions: improved copying/movinghut2010-02-141-2/+4
* fixed #46: wrong username displayed when using suhut2010-02-131-1/+1
* implemented #61: show sum of size of marked fileshut2010-02-091-2/+2
* fixed #54: max_dirsize_for_autopreview option not workinghut2010-02-091-2/+2
* todo: added goals for next minor versionhut2010-02-091-0/+8
* implemented #58: update terminal titlehut2010-02-091-1/+1
* todo: added #60hut2010-02-051-0/+1
* todo: added #58hut2010-02-041-0/+2
* todo: added #56, #57hut2010-01-301-0/+2
* stuffhut2010-01-251-0/+1
* todo: added #52-#54hut2010-01-231-0/+3
* console: better tab completion for OpenConsolehut2010-01-231-1/+1
* directory: get_selection() returns *ordered* marked itemshut2010-01-211-0/+1
* fixed unit testshut2010-01-201-1/+1
* TODO: added #49 and #50hut2010-01-191-0/+2
* browsercolumn: preview more filetypeshut2010-01-191-1/+1
* implemented #48: abbreviate commandshut2010-01-191-1/+1
* done #32hut2010-01-191-1/+1
* TODO: added stuffhut2010-01-191-0/+2
* settings: allow to toggle flushinputhut2010-01-191-1/+1
* done #35: display disk usage of files in current directoryhut2010-01-191-1/+1
* done #34: display free disk spacehut2010-01-191-1/+1
* titlebar: red hostname if logged in with roothut2010-01-191-0/+1
* fixed #43: bookmark ` = 'hut2010-01-181-1/+2
* typohut2010-01-181-1/+1
* stuffhut2010-01-181-0/+1
* actions: bookmark old dir in ` when using :cdhut2010-01-181-1/+1
* fsobject: recognize capital letter file extensionshut2010-01-181-1/+2
* TODO: added entrieshut2010-01-171-0/+5
* just noticed that TODO entry #28 has been done alreadyhut2010-01-141-1/+1
* main: allow to set flags/mode for directly started fileshut2010-01-141-1/+1
* browserview: hide certain bookmarks in the listhut2010-01-131-1/+1
* todo: added #37hut2010-01-131-0/+1
* todo: added #36hut2010-01-121-0/+1
* fixed #31, cd-after-exit works even after pressing ^Chut2010-01-111-1/+1
* added a way to create symlinkshut2010-01-111-1/+1
* added chmod commandhut2010-01-101-1/+1
* todo: added more info on bug #31hut2010-01-091-1/+1
* todo: added a few thingshut2010-01-091-0/+2
* actions: fixed deletion of symlinks to directorieshut2010-01-091-1/+1
* todo: added #33hut2010-01-091-0/+1
* todo: added #32hut2010-01-081-0/+1
164dc03ccd'>^
5e250cb ^


b54b74a ^
5e250cb ^
effb667 ^
d813703 ^
5d77779 ^
b54b74a ^


5d77779 ^
b54b74a ^
5d77779 ^

b54b74a ^
5d77779 ^

b54b74a ^

d813703 ^
5d77779 ^




58f4d66 ^





5d77779 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186








                                  
                   
 


                              
                                           





                                          
                                                   





                      


                              
                                              





                                          
                                                      








                              
                                                          





                                          
                                                                  





                      




















                                               

















                                                                        
                                                                   





                                                                                      
                                                                           





                      

                                        
 

             
                                                                                     




                                                                                      
                                                                     










                                                                             


                                   
        
                                                       
      
        
                                       
                
                    

                                      


                                                                                     
                                                                                       
      
                                            
                              
        


                                       
                                         
                               

                                        
                               

                                         

                                              
        




                    





                                                                                



                  
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
    set -o xtrace
fi

EDITOR="subl -n -b"

add-moons () {
    if [[ -d ".moons" ]]; then
        touch ".moons/$1"
        echo -e "a new moon is orbiting $2"
    else
        path=$(pwd)
        while [ -n "$path" ]; do
            path=${path%/*}
            if [ -d "$path/.moons" ]; then
                touch "$path/.moons/$1"
                echo -e "a new moon is orbiting $2"
                return
            fi
        done
    fi
}

delete-moon-by-moon-id () {
    if [[ -d ".moons" ]]; then
        rm .moons/*"$1"*
        echo -e "the moon $1 has been removed"
    else
        path=$(pwd)
        while [ -n "$path" ]; do
            path=${path%/*}
            if [ -d "$path/.moons" ]; then
                rm "$path/.moons/"*"$1"*
                echo -e "the moon $1 has been removed"
                return
            fi
        done
    fi
}

delete-moons-by-planet () {
    if [[ -d ".moons" ]]; then
        rm .moons/"$1"*
        echo -e "all moons orbiting $1 have been deleted."
    else
        path=$(pwd)
        while [ -n "$path" ]; do
            path=${path%/*}
            if [ -d "$path/.moons" ]; then
                rm "$path/.moons/$1"*
                echo -e "all moons orbiting $1 have been deleted."
                return
            fi
        done
    fi
}

open-moons () {
    if [[ -d ".moons" ]]; then
        for file in .moons/$1; do
            echo -e "$file"
            $EDITOR "$file"
        done
    else
        path=$(pwd)
        while [ -n "$path" ]; do
            path=${path%/*}
            if [ -d "$path/.moons" ]; then
                for file in $path/.moons/$1; do
                    echo -e "$file"
                    $EDITOR "$file"
                done
                return
            fi
        done
    fi
}

list-moons-by-planet () {
    if [[ -d ".moons" ]]; then
        ls -a .moons/"$1"*
    else
        path=$(pwd)
        while [ -n "$path" ]; do
            path=${path%/*}
            if [ -d "$path/.moons" ]; then
                ls -a "$path/.moons/$1"*
                return
            fi
        done
    fi
}

rename-planet-and-orbiting-moons () {
    if [[ -d ".moons" ]]; then
        for file in .moons/"$1"* ; do mv "$file" "${file//$1/$2}" ; done
        echo -e "planets and moons have been renamed from $1 to $2"
    else
        path=$(pwd)
        while [ -n "$path" ]; do
            path=${path%/*}
            if [ -d "$path/.moons" ]; then
                for file in "$path/.moons/$1"* ; do mv "$file" "${file//$1/$2}" ; done
                echo -e "planets and moons have been renamed from $1 to $2"
                return
            fi
        done
    fi
}

PRE_SHORT_RAND=$(openssl rand -base64 6)
SHORT_RAND=${PRE_SHORT_RAND//\//_}

help_text() {
    echo '
    A planet file is the one you care about -- probably an file in an actual project.
    Moon files orbit planets, they are disposable scratch spaces connected to planets.

    usage: ./mm
                    -i(nit)....initialize a directory to store moon files
                    -o(pen)....open a planet file and all of its moon files
                    -l(ist)....list all moons for a given planet file
                    -a(dd).....create a new moon file for a given planet file
                    -d(elete)..remove a moon file by its id
                    -c(lear)...remove all moon files for a given planet file
                    -u(pdate)..rename a planet file and all of its moon files
'
}

if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
    help_text "$@"
    exit
elif [[ "${1-}" =~ ^-*i(nit)?$ ]]; then
    if [[ ! -d ".moons" ]]; then
        mkdir ".moons"
        echo -e "moons initialized"
    else
        echo -e "there's already a moon directory here"
    fi
    exit
elif [[ "${1-}" =~ ^-*o(pen)?$ ]]; then
    $EDITOR "$2"
    open-moons "$2*"
    exit
elif [[ "${1-}" =~ ^-*a(dd)?$ ]]; then
    if [  $# -ge 3 ]; then
        FILE_TYPE="$3" # optionally pass a file type you'd like to append to the moon
    else
        FILE_TYPE="txt" # if you don't provide a file type assume .txt for the new moon
    fi
    NEW_MOON="$2"."$SHORT_RAND"."$FILE_TYPE"
    add-moons "$NEW_MOON" "$2"
    exit
elif [[ "${1-}" =~ ^-*l(ist)?$ ]]; then
    list-moons-by-planet "$2"
    exit
elif [[ "${1-}" =~ ^-*d(elete)?$ ]]; then
    delete-moon-by-moon-id "$2"
    exit
elif [[ "${1-}" =~ ^-*c(lear)?$ ]]; then
    delete-moons-by-planet "$2"
    exit
elif [[ "${1-}" =~ ^-*u(pdate)?$ ]]; then
    mv "$2" "$3"
    rename-planet-and-orbiting-moons "$2" "$3"
    exit
fi

cd "$(dirname "$0")"

main() {
    echo -e '
    Moon Maker

    ⋆。°✩ ☾

    mm is a small program that lets you add orbiting moons to existing planets.'
    help_text "$@"
}

main "$@"