Skip to content

Commit 2ef9a35

Browse files
authored
Merge pull request #14 from M1nd3r/UTest
Documentation update
2 parents 61b1954 + d6d04cf commit 2ef9a35

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

FolderSync/InputHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace FolderSync {
44
public static class InputHandler {
5-
private const string MSG_SYNTAX = "Syntax is: \"From\" \"To\" \"SyncIntervalSeconds\" \"logFile\"\n\nExample: C:\\sourceFolder\\ C:\\targetFolder\\ 300 C:\\logfile.txt\n\nSyncIntervalSeconds and logFile are optional arguments. It is possible to add one or both. If both optional arguments are entered, the order must be preserved.";
5+
private const string MSG_SYNTAX = "Syntax is: \"From\" \"To\" \"SyncIntervalSeconds\" \"LogFile\"\n\nExample: C:\\sourceFolder\\ C:\\targetFolder\\ 300 C:\\logfile.txt\n\nSyncIntervalSeconds and logFile are optional arguments. It is possible to add one or both. If both optional arguments are entered, the order must be preserved.";
66
private static string? fromPath, toPath;
77
private static int intervalSeconds = -1;
88
public static int IntervalSeconds { get => intervalSeconds; }
@@ -40,8 +40,10 @@ private static bool HandleMandatoryArguments(string[] args) {
4040
return HandleToFolder(args[1]);
4141
}
4242
private static bool HandleFourArguments(string[] args) {
43-
if (!IsInterval(args[2]))
43+
if (!IsInterval(args[2])) {
44+
Console.WriteLine("Invalid SyncIntervalSeconds argument.");
4445
return false;
46+
}
4547
AssignInterval(args[2]);
4648
return HandleLogFile(args[3]);
4749
}

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
11
# FolderSync
2-
C# Console application for one-way folder sync
2+
C# Console application for one-way folder sync.
3+
4+
## Arguments
5+
The application takes 4 arguments, 2 mandatory (**From**, **To**) and 2 optional (**SyncIntervalSeconds**, **LogFile** ).
6+
- **From** - path of source folder
7+
- **To** - path of target folder
8+
- **SyncIntervalSeconds** - time interval between two consecutive synchronizations. Value less then 1 will result in a one-time synchronization without repetition.
9+
- **LogFile** - a path to a file where text log will be saved. If log file already exists, new log will be appended. If the file does not exist, app will try to create it. Note that if app is terminated forcefully, parts of log from session might be lost.
10+
11+
## Syntax
12+
There are 4 allowed ways (orders) to pass arguments:
13+
- **From** **To**
14+
- **From** **To** **SyncIntervalSeconds**
15+
- **From** **To** **LogFile**
16+
- **From** **To** **SyncIntervalSeconds** **LogFile**
17+
18+
## Author
19+
Created by Petr Sedláček in 2023.

0 commit comments

Comments
 (0)