Skip to content

Commit

Permalink
Merge pull request #1 from harshfeudal/main
Browse files Browse the repository at this point in the history
[Change]: Fixing bugs and many more!
  • Loading branch information
harshfeudal authored Mar 7, 2023
2 parents f82fe26 + aa1791d commit f12092c
Show file tree
Hide file tree
Showing 11 changed files with 346 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
indent_style=space
indent_size=4
end_of_line=crlf
trim_trailing_whitespace=true
87 changes: 87 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Bug Report
description: Create a bug report
labels:
- 'kind: bug'
body:
- type: markdown
attributes:
value: >
Thanks for reporting!
Please note that you should have a **short title** about describe what the bug is!
If you have any further question, you can join my [Discord server](https://discord.gg/y2DxRWbYsF)!
- type: textarea
id: summary
attributes:
label: Description
description: >
Please provide an abstract description of the issue to the developers,
and why you consider it to be a bug. Please include any specific links
to the documentation, JSON specification, or code.
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Reproduction steps
description: >
How do you trigger the bug? Please walk us through step by step. Be as
specific as possible.
validations:
required: true
- type: textarea
id: results
attributes:
label: Expected vs. actual results
description: >
Please describe what you expected to happen after the steps above and
what actually happened.
validations:
required: true
- type: textarea
id: code
attributes:
label: Minimal code example
description: >
If possible, provide a small and self-contained example that triggers
the bug. Please understand that we cannot analyze and debug large code
bases. Please do not paste screenshots here.
render: Shell
- type: textarea
id: output
attributes:
label: Error messages
description: >
Please provide any kind of error output (compilation errors, exception
messages, stack traces, etc.) which can help to diagnose the error.
render: Shell
- type: input
id: compiler
attributes:
label: Compiler and operating system
description: >
On which operating systems and compilers have you observed the issue?
Include as many relevant details about the environment you experienced
the bug in.
validations:
required: true
- type: input
id: version
attributes:
label: Library version
description: >
Which version of the library did you use? If it is a released version,
please enter the version number (ex: v1.0.0). Otherwise, please enter
the commit hash. If you got the library from another source as the
GitHub repository (e.g., via a package manager), please also state
this.
validations:
required: true
- type: checkboxes
id: validation
attributes:
label: Validation
description: >
Please check these additional steps:
options:
- label: The bug also occurs if the latest version from the [`latest release`](https://github.com/harshfeudal/dotenv/releases/latest).
- label: I have met all requirements about [your instructions](https://github.com/harshfeudal/dotenv/blob/main/README.md) on `REAMDE.md`.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Fast support using Discord
url: https://discord.com/users/622450109317251088
about: Contact with Harshfeudal using Direct Messages!
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,8 @@ x64/
*.vcxproj.filters
*.vcxproj.user

# Others
# Other file/folder
*.exe
lib/**.cmake
.vscode/
build
Footer
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

cmake_minimum_required(VERSION 3.15)
project(Dotenv VERSION 1.0.0 DESCRIPTION "A simple C++ dotenv file reader for reading .env file in simplest way")
project(Dotenv VERSION 1.1.0 DESCRIPTION "A simple C++ dotenv file reader for reading .env file in simplest way")

# Define an INTERFACE library for the header-only library
add_library(${PROJECT_NAME} INTERFACE)
Expand Down
133 changes: 133 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement in the
[Discord][discord] server.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
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
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[discord]: https://discord.gg/BAk2CXpRAT
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
97 changes: 95 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,95 @@
# Dotenv
A simple C++ dotenv file reader for reading .env file in simplest way
# Dotenv for C++

<img src="https://user-images.githubusercontent.com/87577447/223471093-0c3dedd0-780d-40d2-a507-1e07df441909.png" alt="dotenv" align="right" width="250" />

<div align="center">

This library support to load environment variables from a `.env` file and read them like what `.json` does but more simple!

[![Build status](https://ci.appveyor.com/api/projects/status/0yh7hmtp0xu98b31?svg=true)](https://ci.appveyor.com/project/harshfeudal/dotenv)
[![Release](https://img.shields.io/github/v/release/harshfeudal/dotenv?color=brightgreen)](https://github.com/harshfeudal/dotenv/releases/latest)
[![GitHub issues](https://img.shields.io/github/issues/harshfeudal/dotenv)](https://github.com/harshfeudal/dotenv/issues)
[![GitHub license](https://img.shields.io/github/license/harshfeudal/dotenv?color=brightgreen)](https://github.com/harshfeudal/dotenv/blob/main/APACHE-LICENSE.md)
<br />
[![Discord](https://img.shields.io/discord/900408551573438584?style=flat&logo=discord)](https://discord.gg/6Faaqhaqjs)
[![GitHub stars](https://img.shields.io/github/stars/harshfeudal/dotenv?color=ff69b4)](https://github.com/harshfeudal/dotenv/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/harshfeudal/dotenv?color=ff69b4)](https://github.com/harshfeudal/dotenv/network)

</div>

### 📝 About this repository
- This project is owned by [@harshfeudal](https://github.com/harshfeudal). You can join my Discord server [here](https://discord.gg/BAk2CXpRAT)!
- This library can be used for many different projects, currently, this library is enough to make a C++ Discord bot using [D++](https://dpp.dev/) for safety token reader (you can use `.gitignore` to ignore `.env` file).

### 🚨 Usage
1. Download ONLY `dotenv` folder (make sure that it contains `dotenv.h` inside). Simple right?
2. Include it in your project like this:

`main.cpp`
```cpp
#include <dotenv/dotenv.h>
#include <iostream>

int main() {
// Load your .env file
dotenv::load(".env");

// Read your .env variable
const char* my_var = std::getenv("MY_VAR");

// Read it!
std::cout << "The variable is: " << my_var << std::endl;
}
```

Compare it to your `.env` file:
```env
MY_VAR="Hello World!"
```

Done! Simple right?

### ✨ Library features
1. Somehow you really want to skip line (or do whatever you want) like this:
```console
The sentence is:
"Hello World"
- Hello 2023 -
```

... so, with this library feature, to do this, you can just do like this in your `.env` file:
```env
SENTENCE="\n\"Hello World\"\n\t- Hello 2023 -"
```

and it will work as expected!

2. Or, you really want to make a comment like this:
```env
TOKEN="WW91ckRpc2NvcmRCb3RUb2tlbg==" # Your Discord bot token
```

With this library features, your comment will be ignored after the `#` mark! Comments begin where a `#` exists, so if your value contains a `#` please wrap it in quotes.

3. This library just include __only a header file (`dotenv.h`)__!

### 👷 Support platform
- Microsoft Windows 10 `x64/x86`
- Visual Studio platform `x64/x86`
- C++ 17 `ISO/IEC 14882`

### 🤝 Support me
- Please leave me a star if you like it. Thank you very much!
- You can probably help me develop this project too by DMing me on my [Discord profile](https://discord.com/users/622450109317251088).

### 💎 Contribution and Pull Request
I'd probably glad to see if you have anything new to help and support me. To do that, please make one and before you do that, just make sure you've tested the code. I won't bite you if you do it wrong, but just make sure that you have to test it clearly before I merge it.

### 📚 Download
You can download the latest version [here](https://github.com/harshfeudal/dotenv/releases/latest).

<div align="center">
<span>
- © 2023 Harshfeudal. All rights reserved. -
</span>
</div>
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.0.0.{build}
version: 1.1.0.{build}
image: Visual Studio 2022
environment:
matrix:
Expand Down
4 changes: 1 addition & 3 deletions include/dotenv/dotenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#pragma once

// MSVC warning disabled
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#define _CRT_SECURE_NO_WARNINGS 1

#include <cstdlib>
#include <fstream>
Expand Down
3 changes: 2 additions & 1 deletion test/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ MY_INT=42
MY_LONG=-123456789012345
MY_STRING="Hello, world!"
MY_HARSHFEUDAL="\n-----Harshfeudal-----\n\t\"Hello\"\n-----Complete!-----\n" # This is comment, it will not log
MY_HASH="something-with-a-#-hash"
MY_HASH="something-with-a-#-hash"
MY_SPACING="\nNew Line\tTabs\n-------Hey!\r\"What\""
Loading

0 comments on commit f12092c

Please sign in to comment.