Skip to content

Commit be9eb01

Browse files
author
Eric Gourlaouen
committed
Add installation to README
1 parent e407ad4 commit be9eb01

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
# flatten
2+
23
Flatten is a command-line tool to flatten a directory structure.
34

5+
+ [Installation](#installation)
6+
+ [Usage](#usage)
7+
+ [Example](#example)
8+
9+
## Installation
10+
11+
Make sure that you have [Go installed](https://golang.org/dl/), and that you have set up your [Go environment](https://golang.org/doc/code.html#GOPATH).
12+
13+
```
14+
go get github.com/goggle/flatten
15+
```
16+
417
## Usage
18+
519
```
620
Usage:
721
flatten [SOURCE] [DESTINATION] [-c | --copy-only] [-f | --force] [--include-source-files] [-s | --simulate-only] [--verbose]
@@ -26,7 +40,9 @@ Options:
2640
```
2741

2842
## Example
43+
2944
Assume we have the following directory strcuture in `/home/goggle/example/`:
45+
3046
```
3147
/home/goggle/example
3248
├── c_progs
@@ -55,6 +71,7 @@ Assume we have the following directory strcuture in `/home/goggle/example/`:
5571
```
5672

5773
By running `flatten` in `/home/goggle/example` we get the following result:
74+
5875
```
5976
/home/goggle/example
6077
├── data_apples_1.txt
@@ -74,9 +91,11 @@ By running `flatten` in `/home/goggle/example` we get the following result:
7491
├── hello_1
7592
└── hello.c
7693
```
94+
7795
All the files in the subdirectories of `/home/goggle/example/` have been moved into `/home/goggle/example` and the empty directories have been removed. Note, that no regular file has been removed, even though we have file name collisions (e.g. the file `data_apples.txt` exists four times). Flatten does automatically take care of such filename collisions and adds a number to the filename if such a collision happens.
7896

7997
If we want to keep the original files in their subdirectories, we can use the `--copy-only` option. `flatten -c` or `flatten --copy-only` executed in `/home/goggle/example` will lead to the following result:
98+
8099
```
81100
/home/goggle/example
82101
├── c_progs
@@ -117,4 +136,5 @@ If we want to keep the original files in their subdirectories, we can use the `-
117136
├── hello_1
118137
└── hello.c
119138
```
139+
120140
By default, flatten will perform a simulation of its actions first, and ask the user, if he wants to continue.

0 commit comments

Comments
 (0)