mirror of https://github.com/XAMPPRocky/tokei
Add Nuget Config, Bazel and EdgeQL Support, Fix Output Formatter (#999)
* add nuget configuration support * fix test file * add bazel language * fix output format * add languages to readme * fix serialize * add edgeql * edit readme * add test file * fix edgedb
This commit is contained in:
parent
3b3ea97a8c
commit
21be04cba1
|
|
@ -205,12 +205,13 @@ fn foo() {
|
|||
Please include the error message and a minimum working example
|
||||
including the file or file structure.
|
||||
|
||||
```
|
||||
````
|
||||
This file crashes the program:
|
||||
|
||||
<filename>
|
||||
\`\`\`
|
||||
\`\`\`
|
||||
```
|
||||
<file/file structure>
|
||||
```
|
||||
````
|
||||
|
||||
[Rust's enum style]: https://github.com/rust-lang/rfcs/blob/master/text/0430-finalizing-naming-conventions.md#general-naming-conventions
|
||||
|
|
|
|||
|
|
@ -322,6 +322,9 @@ Automake
|
|||
AWK
|
||||
Bash
|
||||
Batch
|
||||
Bazel
|
||||
Bean
|
||||
Bitbake
|
||||
BrightScript
|
||||
C
|
||||
Cabal
|
||||
|
|
@ -355,6 +358,8 @@ Dockerfile
|
|||
DotNetResource
|
||||
DreamMaker
|
||||
Dust
|
||||
Ebuild
|
||||
EdgeDB
|
||||
Edn
|
||||
Elisp
|
||||
Elixir
|
||||
|
|
@ -430,6 +435,7 @@ Mustache
|
|||
Nim
|
||||
Nix
|
||||
NotQuitePerl
|
||||
NuGetConfig
|
||||
Nushell
|
||||
ObjectiveC
|
||||
ObjectiveCpp
|
||||
|
|
|
|||
|
|
@ -134,6 +134,13 @@
|
|||
"line_comment": ["REM", "::"],
|
||||
"extensions": ["bat", "btm", "cmd"]
|
||||
},
|
||||
"Bazel": {
|
||||
"line_comment": ["#"],
|
||||
"doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]],
|
||||
"quotes": [["\\\"", "\\\""], ["'", "'"]],
|
||||
"extensions": ["bzl", "bazel"],
|
||||
"filenames": ["build", "workspace"]
|
||||
},
|
||||
"Bean": {
|
||||
"line_comment": [";"],
|
||||
"quotes": [["\\\"", "\\\""]],
|
||||
|
|
@ -368,6 +375,18 @@
|
|||
"quotes": [["\\\"", "\\\""], ["'", "'"]],
|
||||
"extensions": ["ebuild", "eclass"]
|
||||
},
|
||||
"EdgeQL": {
|
||||
"name": "EdgeQL",
|
||||
"line_comment": ["#"],
|
||||
"quotes": [["'", "'"], ["\\\"", "\\\""], ["$", "$"]],
|
||||
"extensions": ["edgeql"]
|
||||
},
|
||||
"ESDL": {
|
||||
"name": "EdgeDB Schema Definition",
|
||||
"line_comment": ["#"],
|
||||
"quotes": [["'", "'"], ["\\\"", "\\\""]],
|
||||
"extensions": ["esdl"]
|
||||
},
|
||||
"Edn": {
|
||||
"line_comment": [";"],
|
||||
"extensions": ["edn"]
|
||||
|
|
@ -953,6 +972,12 @@
|
|||
"quotes": [["\\\"", "\\\""], ["'", "'"]],
|
||||
"extensions": ["nqp"]
|
||||
},
|
||||
"NuGetConfig": {
|
||||
"name": "NuGet Config",
|
||||
"multi_line_comments": [["<!--", "-->"]],
|
||||
"quotes": [["\\\"", "\\\""], ["'", "'"]],
|
||||
"filenames": ["nuget.config", "packages.config", "nugetdefaults.config"]
|
||||
},
|
||||
"Nushell": {
|
||||
"line_comment": ["#"],
|
||||
"quotes": [
|
||||
|
|
|
|||
|
|
@ -17,11 +17,20 @@ use crate::{
|
|||
use encoding_rs_io::DecodeReaderBytesBuilder;
|
||||
use grep_searcher::{LineIter, LineStep};
|
||||
use rayon::prelude::*;
|
||||
use serde::Serialize;
|
||||
|
||||
use self::LanguageType::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/language_type.rs"));
|
||||
|
||||
impl Serialize for LanguageType {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer {
|
||||
serializer.serialize_str(self.name())
|
||||
}
|
||||
}
|
||||
|
||||
impl LanguageType {
|
||||
/// Parses a given [`Path`] using the [`LanguageType`]. Returning [`Report`]
|
||||
/// on success and giving back ownership of [`PathBuf`] on error.
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ use arbitrary::Arbitrary;
|
|||
/// information about the language, such as multi line comments, single line
|
||||
/// comments, string literal syntax, whether a given language allows nesting
|
||||
/// comments.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Arbitrary, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
#[non_exhaustive]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub enum LanguageType {
|
||||
{% for key, _ in languages -%}
|
||||
#[allow(missing_docs)] {{key}},
|
||||
{% for key, value in languages -%}
|
||||
#[allow(missing_docs)] {% if value.name is defined %} #[serde(alias = "{{value.name}}")] {% else %} #[serde(alias = "{{key}}")] {% endif %} {{key}},
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- 24 lines 13 code 8 comments 3 blanks -->
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- defaultPushSource key works like the 'defaultPushSource' key of NuGet.Config files. -->
|
||||
<!-- This can be used by administrators to prevent accidental publishing of packages to nuget.org. -->
|
||||
<config>
|
||||
<add key="defaultPushSource" value="https://contoso.com/packages/" />
|
||||
</config>
|
||||
|
||||
<!-- Default Package Sources; works like the 'packageSources' section of NuGet.Config files. -->
|
||||
<!-- This collection cannot be deleted or modified but can be disabled/enabled by users. -->
|
||||
<packageSources>
|
||||
<add key="Contoso Package Source" value="https://contoso.com/packages/" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
|
||||
<!-- Default Package Sources that are disabled by default. -->
|
||||
<!-- Works like the 'disabledPackageSources' section of NuGet.Config files. -->
|
||||
<!-- Sources cannot be modified or deleted either but can be enabled/disabled by users. -->
|
||||
<disabledPackageSources>
|
||||
<add key="nuget.org" value="true" />
|
||||
</disabledPackageSources>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# 18 lines 13 code 3 comments 2 blanks
|
||||
|
||||
# build hello-greet
|
||||
cc_library(
|
||||
name = "hello-greet",
|
||||
srcs = ["hello-greet.cc"],
|
||||
hdrs = ["hello-greet.h"],
|
||||
)
|
||||
|
||||
# build hello-world
|
||||
cc_binary(
|
||||
name = "hello-world",
|
||||
srcs = ["hello-world.cc"],
|
||||
deps = [
|
||||
":hello-greet",
|
||||
"//lib:hello-time",
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# 28 lines 21 code 3 comments 4 blanks
|
||||
|
||||
select User {
|
||||
name,
|
||||
friends: {
|
||||
name
|
||||
},
|
||||
has_i := .friends.name ilike '%i%',
|
||||
has_o := .friends.name ilike '%o%',
|
||||
} filter .has_i or .has_o;
|
||||
|
||||
select <User>{} ?? User {name};
|
||||
|
||||
# update the user with the name 'Alice Smith'
|
||||
with module example
|
||||
update User
|
||||
filter .name = 'Alice Smith'
|
||||
set {
|
||||
name := 'Alice J. Smith'
|
||||
};
|
||||
|
||||
# update all users whose name is 'Bob'
|
||||
with module example
|
||||
update User
|
||||
filter .name like 'Bob%'
|
||||
set {
|
||||
name := User.name ++ '*'
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# 20 lines 13 code 4 comments 3 blanks
|
||||
|
||||
# no module block
|
||||
type default::Movie {
|
||||
required property title -> str;
|
||||
# the year of release
|
||||
property year -> int64;
|
||||
required link director -> default::Person;
|
||||
required multi link actors -> default::Person;
|
||||
}
|
||||
|
||||
type default::Person {
|
||||
required property first_name -> str;
|
||||
required property last_name -> str;
|
||||
}
|
||||
|
||||
abstract link friends_base {
|
||||
# declare a specific title for the link
|
||||
annotation title := 'Close contacts';
|
||||
}
|
||||
Loading…
Reference in New Issue