Skip to content

Commit 382f083

Browse files
committed
Make to work with windows, remove unnecessary config keys
1 parent e66a9e2 commit 382f083

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

internal/app/edit/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func editTodoAssociatedWith(directory string) error {
4444
}
4545

4646
var todoList []data.TodoEntity
47-
for _, item := range strings.Split(string(result), "\n") {
47+
for _, item := range strings.Split(strings.ReplaceAll(string(result), "\r\n", "\n"), "\n") {
4848
if item != "" {
4949
todoList = append(todoList, data.TodoEntity{Text: item})
5050
}

internal/config/config_keys.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package config
22

3-
const DATA_FOLDER_KEY = "DATA_FOLDER_KEY"
3+
const USER_DEFINED_DATA_FOLDER = "USER_DEFINED_DATA_FOLDER"
44
const LIST_AFTER_ADDING_TODO = "LIST_AFTER_ADDING_TODO"
5-
const USER_DEFINED_HOME_PATH = "USER_DEFINED_HOME_PATH"
5+
const LIST_AFTER_EDITING_TODO = "LIST_AFTER_EDITING_TODO"
6+
const LIST_AFTER_REMOVING_TODO = "LIST_AFTER_REMOVING_TODO"

internal/pkg/data/data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func WriteTodoToFile(dataFileFullPath string, todoList []TodoEntity) error {
4040
}
4141

4242
func GetDataFolder() (string, error) {
43-
dataFolder := strings.TrimSpace(viper.GetString(config.DATA_FOLDER_KEY))
43+
dataFolder := strings.TrimSpace(viper.GetString(config.USER_DEFINED_DATA_FOLDER))
4444
if dataFolder == "" {
4545
home, errHomeDir := os.UserHomeDir()
4646
if errHomeDir != nil {

0 commit comments

Comments
 (0)