Skip to content

Commit 55059e8

Browse files
authored
Merge pull request #9 from pbs-data-solutions/readme
Update README
2 parents e897295 + e20d6c9 commit 55059e8

File tree

3 files changed

+246
-1
lines changed

3 files changed

+246
-1
lines changed

CONTRIBUTING.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Contributing
2+
3+
## Where to start
4+
5+
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are
6+
welcome.
7+
8+
The best place to start is to check the [issues](https://github.com/pbs-data-solution/prelude-file-renamer/issues)
9+
for something that interests you.
10+
11+
## Bug Reports
12+
13+
Please include:
14+
15+
1. A short, self-contained Python snippet reproducing the problem. You can format the code by using
16+
[GitHub markdown](https://docs.github.com/en/free-pro-team@latest/github/writing-on-github). For example:
17+
18+
```sh
19+
prelude-file-renamer /my/file/path
20+
```
21+
22+
2. Explain what is currently happening and what you expect instead.
23+
24+
## Working on the code
25+
26+
### Fork the project
27+
28+
In order to work on the project you will need your own fork. To do this click the "Fork" button on
29+
this project.
30+
31+
Once the project is forked clone it to your local machine:
32+
33+
```sh
34+
git clone [email protected]:your-user-name/prelude-file-renamer
35+
cd prelude-file-renamer
36+
git remote add upstream [email protected]:pbs-data-solution/prelude-file-renamer
37+
```
38+
39+
This creates the directory prelude-file-renamer and connects your repository to the upstream (main
40+
project) repository.
41+
42+
### Creating a branch
43+
44+
You want your main branch to reflect only production-ready code, so create a feature branch for
45+
making your changes. For example:
46+
47+
```sh
48+
git checkout -b my-new-feature
49+
```
50+
51+
This changes your working directory to the my-new-feature branch. Keep any changes in this branch
52+
specific to one bug or feature so the purpose is clear. You can have many my-new-features and switch
53+
in between them using the git checkout command.
54+
55+
When creating this branch, make sure your main branch is up to date with the latest upstream
56+
main version. To update your local main branch, you can do:
57+
58+
```sh
59+
git checkout main
60+
git pull upstream main --ff-only
61+
```
62+
63+
### Code linting, formatting, and tests
64+
65+
You can run linting on your code at any time with:
66+
67+
```sh
68+
cargo clippy
69+
```
70+
71+
To format the code run:
72+
73+
```sh
74+
cargo fmt
75+
```
76+
77+
To run the tests:
78+
79+
```sh
80+
cargo test
81+
```
82+
83+
To ensure the code compiles run:
84+
85+
```sh
86+
cargo check
87+
```
88+
89+
Be sure to run all these checks before submitting your pull request.
90+
91+
## Committing your code
92+
93+
Once you have made changes to the code on your branch you can see which files have changed by
94+
running:
95+
96+
```sh
97+
git status
98+
```
99+
100+
If new files were created that and are not tracked by git they can be added by running:
101+
102+
```sh
103+
git add .
104+
```
105+
106+
Now you can commit your changes in your local repository:
107+
108+
```sh
109+
git commit -am 'Some short helpful message to describe your changes'
110+
```
111+
112+
## Push your changes
113+
114+
Once your changes are ready and all linting/tests are passing you can push your changes to your
115+
forked repositry:
116+
117+
```sh
118+
git push origin my-new-feature
119+
```
120+
121+
origin is the default name of your remote repositry on GitHub. You can see all of your remote
122+
repositories by running:
123+
124+
```sh
125+
git remote -v
126+
```
127+
128+
## Making a Pull Request
129+
130+
After pushing your code to origin it is now on GitHub but not yet part of the prelude-file-renamer
131+
project. When you’re ready to ask for a code review, file a pull request. Before you do, once again
132+
make sure that you have followed all the guidelines outlined in this document regarding code style,
133+
tests, and documentation. You should also double check your branch changes against the branch it
134+
was based on by:
135+
136+
1. Navigating to your repository on GitHub
137+
1. Click on Branches
138+
1. Click on the Compare button for your feature branch
139+
1. Select the base and compare branches, if necessary. This will be main and my-new-feature,
140+
respectively.
141+
142+
### Make the pull request
143+
144+
If everything looks good, you are ready to make a pull request. This is how you let the maintainers
145+
of the prelude-file-renamer project know you have code ready to be reviewed. To submit the pull request:
146+
147+
1. Navigate to your repository on GitHub
148+
1. Click on the Pull Request button for your feature branch
149+
1. You can then click on Commits and Files Changed to make sure everything looks okay one last time
150+
1. Write a description of your changes in the Conversation tab
151+
1. Click Send Pull Request
152+
153+
This request then goes to the repository maintainers, and they will review the code.
154+
155+
### Updating your pull request
156+
157+
Changes to your code may be needed based on the review of your pull request. If this is the case you
158+
can make them in your branch, add a new commit to that branch, push it to GitHub, and the pull
159+
request will be automatically updated. Pushing them to GitHub again is done by:
160+
161+
```sh
162+
git push origin my-new-feature
163+
```
164+
165+
This will automatically update your pull request with the latest code and restart the Continuous
166+
Integration tests.
167+
168+
Another reason you might need to update your pull request is to solve conflicts with changes that
169+
have been merged into the main branch since you opened your pull request.
170+
171+
To do this, you need to rebase your branch:
172+
173+
```sh
174+
git checkout my-new-feature
175+
git fetch upstream
176+
git rebase upstream/main
177+
```
178+
179+
There may be some merge conficts that need to be resolved. After the feature branch has been update
180+
locally, you can now update your pull request by pushing to the branch on GitHub:
181+
182+
```sh
183+
git push origin my-new-feature
184+
```
185+
186+
If you rebased and get an error when pushing your changes you can resolve it with:
187+
188+
```sh
189+
git push origin my-new-feature --force
190+
```
191+
192+
## Delete your merged branch (optional)
193+
194+
Once your feature branch is accepted into upstream, you’ll probably want to get rid of the branch.
195+
First, merge upstream main into your main branch so git knows it is safe to delete your branch:
196+
197+
```sh
198+
git fetch upstream
199+
git checkout main
200+
git merge upstream/main
201+
```
202+
203+
Then you can do:
204+
205+
```sh
206+
git branch -d my-new-feature
207+
```
208+
209+
Make sure you use a lower-case -d, or else git won’t warn you if your feature branch has not
210+
actually been merged.
211+
212+
The branch will still exist on GitHub, so to delete it there do:
213+
214+
```sh
215+
git push origin --delete my-new-feature
216+
```

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
11
# Vision File Renamer
22

33
Remove leading hashes from exported Prelude xml files and replace them with the directory name.
4+
5+
## Installation
6+
7+
```sh
8+
cargo install --path .
9+
```
10+
11+
## Usage
12+
13+
```sh
14+
vision-file-renamer [OPTIONS] <DIRECTORY>
15+
```
16+
17+
### Arguments
18+
19+
- <DIRECTORY> Path to the directory that contains the files to rename
20+
21+
### OPTIONS
22+
23+
- -p, --prefix-length <PREFIX_LENGTH>: The length ofthe prefix to replace
24+
- -r, --recursive: Recursively traverse directories
25+
- -n, --no-append: Don't append the parent directory name to the file name
26+
- -v, --verbose: Verrbose output
27+
- -h, --help: Print help
28+
- -V, --version: Print version
29+
30+
## Contributing
31+
32+
Contributions to this project are welcome. If you are interesting in contributing please see our [contributing guide](CONTRIBUTING.md)

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct Args {
2424
#[arg(
2525
short,
2626
long,
27-
help = "Don't append the parent directory to the file name"
27+
help = "Don't append the parent directory name to the file name"
2828
)]
2929
no_append: bool,
3030

0 commit comments

Comments
 (0)