-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: architecture, changed map names
- Loading branch information
Showing
48 changed files
with
142 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Directory "internal" | ||
|
||
The insides of the program. If you only need a console program, you can get rid of the `web` | ||
|
||
## About subdirectories | ||
|
||
- `lemin` - all logic of lemin here | ||
- `web` - web logic here, depends on `lemin` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package lemin | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"io" | ||
"os" | ||
"strings" | ||
) | ||
|
||
// RunProgramWithFile - path is filepath, writes result to output. Close program if has error. | ||
func RunProgramWithFile(path string, showContent bool) { | ||
err := WriteResultByFilePath(os.Stdout, path, showContent) | ||
if err != nil { | ||
fmt.Printf("ERROR: %v\n", err.Error()) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
// WriteResultByFilePath - path is filepath. | ||
func WriteResultByFilePath(w io.Writer, path string, writeContent bool) error { | ||
file, err := os.Open(path) | ||
defer file.Close() | ||
if err != nil { | ||
return err | ||
} else if fInfo, _ := file.Stat(); fInfo.IsDir() { | ||
err = fmt.Errorf("%v is directory", fInfo.Name()) | ||
return err | ||
} | ||
|
||
scanner := bufio.NewScanner(file) | ||
result, err := GetResult(scanner) | ||
if err != nil { | ||
return err | ||
} | ||
if writeContent { | ||
file.Seek(0, io.SeekStart) | ||
_, err = io.Copy(w, file) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Fprint(w, "\n\n# result\n") | ||
} | ||
result.WriteResult(w) | ||
|
||
return nil | ||
} | ||
|
||
// WriteResultByContent - using for Web, inputs writer for write result, writes nothing if returns error | ||
func WriteResultByContent(w io.Writer, content string, writeContent bool) error { | ||
scanner := bufio.NewScanner(strings.NewReader(content)) | ||
result, err := GetResult(scanner) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if writeContent { | ||
fmt.Fprintf(w, "%v\n\n", content) | ||
} | ||
result.WriteResult(w) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Directory "maps" | ||
|
||
This directory is responsible for maps | ||
|
||
## Subdirectories | ||
|
||
- `audit` - maps for audit | ||
- `bhandary` - maps for check bhandary algo | ||
- `custom` - maps created for fun | ||
- `default` - default maps | ||
- `planets` - big maps as with planets name |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Directory "pkg" | ||
|
||
Here is packages wich you can use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package lemin | ||
|
||
import ( | ||
"io" | ||
|
||
lemin "github.com/Dias1c/lem-in/internal/lemin" | ||
) | ||
|
||
// RunProgramWithFile - path is filepath, writes result to output. Close program if has error. | ||
func RunProgramWithFile(path string, showContent bool) { | ||
lemin.RunProgramWithFile(path, showContent) | ||
} | ||
|
||
// WriteResultByFilePath - path is filepath. | ||
func WriteResultByFilePath(w io.Writer, path string, writeContent bool) error { | ||
return lemin.WriteResultByFilePath(w, path, writeContent) | ||
} | ||
|
||
// WriteResultByContent - using for Web, inputs writer for write result, writes nothing if returns error | ||
func WriteResultByContent(w io.Writer, content string, writeContent bool) error { | ||
return lemin.WriteResultByContent(w, content, writeContent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package web | ||
|
||
import ( | ||
web "github.com/Dias1c/lem-in/internal/web" | ||
) | ||
|
||
// RunServer - starts server with setted port | ||
func RunServer(port string) { | ||
web.RunServer(port) | ||
} |