Skip to content

Commit

Permalink
Fix the align of code
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedcat committed Feb 15, 2023
1 parent 60229a2 commit d3db218
Show file tree
Hide file tree
Showing 13 changed files with 254 additions and 251 deletions.
17 changes: 10 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +25,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
26 changes: 13 additions & 13 deletions .github/workflows/File-Sorter-Core Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

12 changes: 6 additions & 6 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Greetings

on: [pull_request, issues]
on: [ pull_request, issues ]

jobs:
greeting:
Expand All @@ -9,8 +9,8 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thanks for the issue! i will see it as soon as possible and i will try to give you an answer or make a solution.'
pr-message: 'Thank you for your contribution to this project! i will see and check your request as soon as possible, until then, make your coffee and keep coding! '
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thanks for the issue! i will see it as soon as possible and i will try to give you an answer or make a solution.'
pr-message: 'Thank you for your contribution to this project! i will see and check your request as soon as possible, until then, make your coffee and keep coding! '
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ file(WRITE config/config.conf
debug_log\ 0\n
default_dir_path\ /home/$ENV{USER}/default_sorter_path/\n
enable_default_path\ 1\n
move_files_without_ext\ 0\n
move_files_without_ext\ 0\n
\n
[check]\n
\n
Expand All @@ -54,8 +54,8 @@ file(WRITE config/config.conf
[targets]\n
\n
[done]\n
[exclude]\n
[done])
[exclude]\n
[done])

file(WRITE service/file-sorter.service
[Unit]\n
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

# Introduction

Automatically transfer files, which are scattered outside of their folders, to the folders to which they belong using a simple config file and a tool.
Automatically transfer files, which are scattered outside of their folders, to the folders to which they belong using a
simple config file and a tool.

# Installation requirements

The following packages must be installed.<br>

```
sudo apt-get install build-essential cmake git gcc
```
Expand Down Expand Up @@ -62,22 +65,23 @@ move_files_without_ext 0
[done]
```

The config is stored in the following location:<br>
`~/.local/share/file_sorter/config/config.conf`

The information is as follows.<br>

Field | Description
---------|--------------
`check_interval` | The time ( seconds ) between checks (for new files etc).
`parse_interval` | The time ( seconds ) to read the config file again for any changes.
`debug_log` | For debugging. To enter debug mode, the value of the debugLog field must be changed to 1.
`default_dir_path` | If a file is found outside of a folder and no specific location has been specified to which it should be moved, then it will go to default_dir_path.
`enable_default_path` | If this option is enabled, then any file that do not have a specific location to which they should be sent will be sent to the default.
`move_files_without_ext` | If this option is enabled, then the sorter will move files that has no extension, otherwise those files will be ignored.
`[check]` | This field includes all locations where the program will look for files. Each location that enters this field must be entered before `[done_check]`.
`[targets]` | This field contains all the file extensions and all the locations that these files should be sent to. Each line in this field consists of two elements that are separated by a space. The first element is the extension of the file and the second is the location where this file should be sent. Also each new line must be entered before `[done_targets]`.
`[exclude]` | This field contains all the file extensions and all the locations that these files should be ignored. Each line in this field consists of two elements that are separated by a space. The first element is the extension of the file and the second is the location where it must ignore a file. If a file has to be ignored in any location, then * must be placed instead of location. Also each new line must be entered before `[done]`.
Field | Description
--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`check_interval` | The time ( seconds ) between checks (for new files etc).
`parse_interval` | The time ( seconds ) to read the config file again for any changes.
`debug_log` | For debugging. To enter debug mode, the value of the debugLog field must be changed to 1.
`default_dir_path` | If a file is found outside of a folder and no specific location has been specified to which it should be moved, then it will go to default_dir_path.
`enable_default_path` | If this option is enabled, then any file that do not have a specific location to which they should be sent will be sent to the default.
`move_files_without_ext` | If this option is enabled, then the sorter will move files that has no extension, otherwise those files will be ignored.
`[check]` | This field includes all locations where the program will look for files. Each location that enters this field must be entered before `[done_check]`.
`[targets]` | This field contains all the file extensions and all the locations that these files should be sent to. Each line in this field consists of two elements that are separated by a space. The first element is the extension of the file and the second is the location where this file should be sent. Also each new line must be entered before `[done_targets]`.
`[exclude]` | This field contains all the file extensions and all the locations that these files should be ignored. Each line in this field consists of two elements that are separated by a space. The first element is the extension of the file and the second is the location where it must ignore a file. If a file has to be ignored in any location, then * must be placed instead of location. Also each new line must be entered before `[done]`.

An example of `[check]`:<br>

Expand Down Expand Up @@ -114,12 +118,14 @@ In the example above the first part consists of the extensions `.py` and `.c` an
locations `/home/username/Documents/py/` and `*`.

# Tool

Due to the nature of this program and this config i made a tool that helps the user to do the following:<br>
- Add locations to the config check field.<br>
- Be able to add targets.<br>
- To be able to delete check and targets.<br>
- To be able to see the check and targets.<br>
- To be able to change the program settings.<br><br>

- Add locations to the config check field.<br>
- Be able to add targets.<br>
- To be able to delete check and targets.<br>
- To be able to see the check and targets.<br>
- To be able to change the program settings.<br><br>

The tool described above can be found here:<br>
https://github.com/EmbeddedCat/file-sorter-terminal-tool
Expand All @@ -130,11 +136,13 @@ The program can be run using `systemd`. To start the program from `systemd` the
``` systemctl --user start file-sorter```

# Compatible operating systems

- [X] Linux
- [ ] Windows
- [ ] Mac

# Contributors

<a href="https://github.com/EmbeddedCat/file-sorter-core/graphs/contributors">
<img src="https://contrib.rocks/image?repo=EmbeddedCat/file-sorter-core" />
</a>
10 changes: 5 additions & 5 deletions config/config.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[basic_config]
check_interval 3
parse_interval 5
check_interval 3000
parse_interval 5000
debug_log 0
default_dir_path /home/username/default_sorter_path/
default_dir_path /home/embeddedcat/default_sorter_path/
enable_default_path 1
move_files_without_ext 1
move_files_without_ext 0

[check]

Expand All @@ -14,4 +14,4 @@ move_files_without_ext 1

[done]
[exclude]
[done]
[done]
26 changes: 13 additions & 13 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@

#include <memory.h>

#define FAILED_TO_PARSE -0x1
#define FAILED_TO_PARSE -0x1


// config options.
struct options
{
unsigned int o_check_interval; // check interval option.
unsigned int o_parse_interval; // parse interval option.
unsigned int o_debug_log:1; // debug log option.
char *o_default_path; // default path option.
unsigned int o_enable_default:1; // enable default path option.
unsigned int o_move_no_ext:1; // move files that has no extention.
unsigned int o_check_interval; // check interval option.
unsigned int o_parse_interval; // parse interval option.
unsigned int o_debug_log: 1; // debug log option.
char *o_default_path; // default path option.
unsigned int o_enable_default: 1; // enable default path option.
unsigned int o_move_no_ext: 1; // move files that has no extention.
};

// config lists.
struct lists
{
char *(*l_check_list); // the check list of the config.
char *(*l_target_list); // the targests of the config.
char *(*l_exclude_list); // the excludes of the config.
char *(*l_check_list); // the check list of the config.
char *(*l_target_list); // the targests of the config.
char *(*l_exclude_list); // the excludes of the config.
};

// the config file.
struct config
{
struct options c_options; // the options of the config.
struct lists c_lists; // the lists of the config.
struct options c_options; // the options of the config.
struct lists c_lists; // the lists of the config.
};


Expand All @@ -40,7 +40,7 @@ struct config
**/
static void inline init_config(struct config *config)
{
memset(config, 0x0, sizeof(struct config));
memset(config, 0x0, sizeof(struct config));
}

/**
Expand Down
2 changes: 0 additions & 2 deletions include/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
extern void logger(const char *msg, int type);




#endif
20 changes: 9 additions & 11 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@
#endif




int main(int argc, char *argv[])
{
#ifdef __unix__
struct config config_p;
// initialzize the config.
init_config(&config_p);
struct config config_p;
// initialzize the config.
init_config(&config_p);

// parse config.
parse_config(&config_p);
// parse config.
parse_config(&config_p);

// start procces
start_sorter(&config_p);
// start procces
start_sorter(&config_p);

destroy_config(&config_p);
destroy_config(&config_p);
#else
// TODO - call logger and write that the oparating system is not compatiple.
// TODO - call logger and write that the oparating system is not compatiple.
#endif
}
Loading

0 comments on commit d3db218

Please sign in to comment.