Skip to content

Commit b90de4a

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 79a132c + 8e8c736 commit b90de4a

File tree

8 files changed

+231
-55
lines changed

8 files changed

+231
-55
lines changed

.github/CODE_OF_CONDUCT.md

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
7kxyfz4v@duck.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

.github/workflows/clippy.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on: push
2+
name: Clippy Check
3+
jobs:
4+
clippy_check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v1
8+
- run: rustup component add clippy
9+
- uses: actions-rs/clippy-check@v1
10+
with:
11+
token: ${{ secrets.GITHUB_TOKEN }}
12+
args: --all-features

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: release
1+
name: Release
22

33
on:
44
release:

.github/workflows/rust.yml

+56-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Rust
1+
name: Rust Continuous Integration
22

33
on:
44
push:
@@ -10,13 +10,62 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
13+
check:
14+
name: Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions-rs/toolchain@v1
19+
with:
20+
profile: minimal
21+
toolchain: stable
22+
override: true
23+
- uses: actions-rs/cargo@v1
24+
with:
25+
command: check
1426

27+
test:
28+
name: Test Suite
1529
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: actions-rs/toolchain@v1
33+
with:
34+
profile: minimal
35+
toolchain: stable
36+
override: true
37+
- uses: actions-rs/cargo@v1
38+
with:
39+
command: test
1640

41+
fmt:
42+
name: Rustfmt
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: actions-rs/toolchain@v1
47+
with:
48+
profile: minimal
49+
toolchain: stable
50+
override: true
51+
- run: rustup component add rustfmt
52+
- uses: actions-rs/cargo@v1
53+
with:
54+
command: fmt
55+
args: --all -- --check
56+
57+
clippy:
58+
name: Clippy
59+
runs-on: ubuntu-latest
1760
steps:
18-
- uses: actions/checkout@v3
19-
- name: Build
20-
run: cargo build --verbose
21-
- name: Run tests
22-
run: cargo test --verbose
61+
- uses: actions/checkout@v2
62+
- uses: actions-rs/toolchain@v1
63+
with:
64+
profile: minimal
65+
toolchain: stable
66+
override: true
67+
- run: rustup component add clippy
68+
- uses: actions-rs/cargo@v1
69+
with:
70+
command: clippy
71+
args: -- -D warnings

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Set <u>Sh</u>ell <u>E</u>nvironment variables across multiple shells with a sing
44

55
[![Fork me on GitHub](https://img.shields.io/badge/-Fork%20me%20on%20Github-blueviolet?style=flat-square&logo=github)](https://github.com/superatomic/xshe/fork)
66
[![Leave a GitHub Repo Star](https://img.shields.io/badge/-Star%20Repo-blue?style=flat-square&logo=github)](https://github.com/superatomic/xshe/)
7+
[![Open an Issue](https://img.shields.io/badge/-Open%20an%20Issue-orange?style=flat-square&logo=github)](https://github.com/superatomic/xshe/issues/new)
78

89
---
910

src/cli.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,23 @@
1313

1414
//! Defines the CLI interface for Xshe.
1515
16-
17-
use std::path::PathBuf;
1816
use clap::{ArgEnum, Parser};
17+
use std::path::PathBuf;
1918

2019
/// CLI Parser.
2120
#[derive(Parser)]
2221
#[clap(version, about, long_about = None)]
2322
pub(crate) struct Cli {
24-
2523
#[clap(arg_enum)]
2624
#[clap(help = "The shell to generate a script")]
2725
pub shell: Shell,
2826

2927
#[clap(short, long, parse(from_os_str), value_name = "FILE")]
3028
#[clap(help = "Specify a custom location to read from")]
31-
#[clap(long_help =
32-
"Specifies a custom location to read from. \n\
29+
#[clap(long_help = "Specifies a custom location to read from. \n\
3330
This defaults to $XDG_CONFIG_HOME, or ~/.config if not set. \n\
3431
\n\
35-
The file must be in TOML format <https://toml.io/en/>."
36-
)]
32+
The file must be in TOML format <https://toml.io/en/>.")]
3733
pub file: Option<PathBuf>,
3834
}
3935

src/config_file.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
//! Defines the structure of the TOML configuration file.
1515
16-
17-
use std::{path::PathBuf, string::String, fs};
18-
use std::collections::HashMap;
1916
use indexmap::IndexMap;
2017
use serde::Deserialize;
18+
use std::collections::HashMap;
19+
use std::path::Path;
20+
use std::{fs, string::String};
2121

2222
pub(crate) type EnvironmentVariables = IndexMap<String, EnvValue>;
2323

@@ -31,7 +31,7 @@ pub(crate) struct ConfigFile {
3131
}
3232

3333
impl ConfigFile {
34-
pub(crate) fn load(path: &PathBuf) -> FileResult {
34+
pub(crate) fn load(path: &Path) -> FileResult {
3535
let toml_string = match fs::read_to_string(path) {
3636
Ok(valid_file) => valid_file,
3737
Err(_) => return FileResult::NotFound,

0 commit comments

Comments
 (0)