├── .gitignore ├── elixir ├── .formatter.exs ├── .gitignore ├── README.md ├── config │ ├── config.exs │ ├── dev.exs │ ├── prod.exs │ ├── runtime.exs │ └── test.exs ├── lib │ ├── mix │ │ └── tasks │ │ │ └── projector.ex │ ├── projector.ex │ ├── projector │ │ ├── application.ex │ │ ├── opts.ex │ │ ├── project.ex │ │ └── project_server.ex │ ├── projector_web.ex │ └── projector_web │ │ └── router.ex ├── mix.exs ├── mix.lock └── test │ ├── projector │ ├── opts_test.exs │ └── project_test.exs │ ├── projector_test.exs │ └── test_helper.exs ├── go ├── cmd │ ├── projector │ │ └── main.go │ ├── web.go │ └── web │ │ └── main.go ├── go.mod ├── go.sum └── pkg │ ├── config │ ├── config.go │ ├── config_test.go │ └── export_test.go │ └── projector │ ├── projector.go │ └── projector_test.go ├── rust ├── .gitignore ├── Cargo.lock ├── Cargo.toml └── src │ ├── bin │ ├── cli.rs │ ├── str.rs │ └── web.rs │ ├── config.rs │ ├── error.rs │ ├── file.rs │ ├── lib.rs │ ├── operations │ ├── add.rs │ ├── mod.rs │ ├── operation.rs │ └── remove.rs │ └── opts.rs └── typescript ├── jest.config.js ├── package.json ├── src ├── __tests__ │ ├── config.ts │ └── opts.ts ├── config.ts ├── main.ts ├── operation │ ├── __tests__ │ │ ├── add.ts │ │ └── remove.ts │ ├── add.ts │ ├── index.ts │ └── remove.ts └── opts.ts ├── tsconfig.json ├── yarn-error.log └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | typescript/node_modules 2 | rust/target 3 | 4 | -------------------------------------------------------------------------------- /elixir/.formatter.exs: -------------------------------------------------------------------------------- 1 | # Used by "mix format" 2 | [ 3 | inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] 4 | ] 5 | -------------------------------------------------------------------------------- /elixir/.gitignore: -------------------------------------------------------------------------------- 1 | # The directory Mix will write compiled artifacts to. 2 | /_build/ 3 | 4 | # If you run "mix test --cover", coverage assets end up here. 5 | /cover/ 6 | 7 | # The directory Mix downloads your dependencies sources to. 8 | /deps/ 9 | 10 | # Where third-party dependencies like ExDoc output generated docs. 11 | /doc/ 12 | 13 | # Ignore .fetch files in case you like to edit your project deps locally. 14 | /.fetch 15 | 16 | # If the VM crashes, it generates a dump, let's ignore it too. 17 | erl_crash.dump 18 | 19 | # Also ignore archive artifacts (built via "mix archive.build"). 20 | *.ez 21 | 22 | # Ignore package tarball (built via "mix hex.build"). 23 | projector-*.tar 24 | 25 | # Temporary files, for example, from tests. 26 | /tmp/ 27 | -------------------------------------------------------------------------------- /elixir/README.md: -------------------------------------------------------------------------------- 1 | # Projector 2 | 3 | ## Usage 4 | 5 | 1. Run `mix deps.get` to fetch dependencies. 6 | 2. Run `mix compile` to do the initial compile. 7 | 3. Run `mix test` for tests. 8 | 4. Run `mix help projector` to see command line instructions. 9 | 5. Run web server with `mix run --no-halt` (or `iex -S mix` if you want an interactive shell). 10 | -------------------------------------------------------------------------------- /elixir/config/config.exs: -------------------------------------------------------------------------------- 1 | import Config 2 | 3 | import_config "#{config_env()}.exs" 4 | -------------------------------------------------------------------------------- /elixir/config/dev.exs: -------------------------------------------------------------------------------- 1 | import Config 2 | 3 | # Dev-specific compile-time config. 4 | -------------------------------------------------------------------------------- /elixir/config/prod.exs: -------------------------------------------------------------------------------- 1 | import Config 2 | 3 | # Prod-specific compile-time config. 4 | -------------------------------------------------------------------------------- /elixir/config/runtime.exs: -------------------------------------------------------------------------------- 1 | import Config 2 | 3 | # Runtime config. 4 | 5 | config_path = 6 | case config_env() do 7 | :test -> 8 | "put something here for test" 9 | 10 | :dev -> 11 | "put something here for dev" 12 | 13 | :prod -> 14 | System.get_env("XDG_CONFIG_HOME") || 15 | raise "Start using an operating system with xdg you goof" 16 | end 17 | 18 | config :projector, Projector, config_path: config_path 19 | -------------------------------------------------------------------------------- /elixir/config/test.exs: -------------------------------------------------------------------------------- 1 | import Config 2 | 3 | # Test-specific compile-time config. 4 | 5 | config :logger, level: :warn 6 | -------------------------------------------------------------------------------- /elixir/lib/mix/tasks/projector.ex: -------------------------------------------------------------------------------- 1 | defmodule Mix.Tasks.Projector do 2 | @moduledoc """ 3 | Command Line Interface for the Elixir Projector version. 4 | 5 | mix projector [--pwd PATH] [--config PATH] print [key] 6 | mix projector [--pwd PATH] [--config PATH] [key] 7 | 8 | prints out the configuration for the current directory and its parents. If you 9 | provide no arguments to projector, this is the default behavior. 10 | 11 | mix projector [--pwd PATH] [--config PATH] link /absolute/to/other/directory 12 | 13 | will link the cwd (or pwd) to another directories config. This is useful for 14 | mirroring configs. 15 | 16 | mix projector [--pwd PATH] [--config PATH] unlink 17 | 18 | will remove any previously established link. 19 | 20 | mix projector [--pwd PATH] [--config PATH] del key_to_delete 21 | 22 | deletes a key in the current directories config. Will not delete key out of 23 | parent. 24 | 25 | mix projector [--pwd PATH] [--config PATH] add key_to_add value 26 | 27 | adds key and value to the current directories config. 28 | 29 | mix projector [--pwd PATH] [--config PATH] which 30 | 31 | shows the current path to the config file. 32 | 33 | ## Examples 34 | 35 | mix projector --pwd /foo add foo "some value for foo" 36 | 37 | """ 38 | 39 | use Mix.Task 40 | 41 | @shortdoc "Command Line Interface for the Elixir Projector version" 42 | 43 | @impl Mix.Task 44 | def run(args) do 45 | case Projector.Opts.parse(args) do 46 | {options, []} -> 47 | IO.inspect(options, label: "OPTIONS") 48 | command("print", [], options) 49 | 50 | {options, [command | rest]} -> 51 | IO.inspect(command, label: "COMMAND") 52 | IO.inspect(rest, label: "REST") 53 | IO.inspect(options, label: "OPTIONS") 54 | command(command, rest, options) 55 | end 56 | end 57 | 58 | def command("print", [], _options) do 59 | # TODO 60 | end 61 | 62 | def command("add", [key | rest], options) do 63 | # TODO 64 | end 65 | 66 | def command("del", [key], options) do 67 | # TODO 68 | end 69 | 70 | def command("link", [to_path], options) do 71 | # TODO 72 | end 73 | 74 | def command("unlink", [path], options) do 75 | # TODO 76 | end 77 | 78 | def command("which", [], options) do 79 | # TODO 80 | end 81 | 82 | def command(command, rest, options) do 83 | raise ArgumentError, 84 | message: 85 | "Invalid command: #{command}, with args: #{inspect(rest)}, and options: #{inspect(options)}" 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /elixir/lib/projector.ex: -------------------------------------------------------------------------------- 1 | defmodule Projector do 2 | @moduledoc """ 3 | Documentation for `Projector`. 4 | """ 5 | end 6 | -------------------------------------------------------------------------------- /elixir/lib/projector/application.ex: -------------------------------------------------------------------------------- 1 | defmodule Projector.Application do 2 | # See https://hexdocs.pm/elixir/Application.html 3 | # for more information on OTP Applications 4 | @moduledoc false 5 | 6 | use Application 7 | 8 | require Logger 9 | 10 | @impl true 11 | def start(_type, _args) do 12 | children = [ 13 | {Plug.Cowboy, scheme: :http, plug: ProjectorWeb.Router, options: [port: 8080]} 14 | # Starts a worker by calling: Projector.Worker.start_link(arg) 15 | # {Projector.Worker, arg} 16 | ] 17 | 18 | Logger.info("[Application] starting web server at http://localhost:8080") 19 | 20 | # See https://hexdocs.pm/elixir/Supervisor.html 21 | # for other strategies and supported options 22 | opts = [strategy: :one_for_one, name: Projector.Supervisor] 23 | Supervisor.start_link(children, opts) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /elixir/lib/projector/opts.ex: -------------------------------------------------------------------------------- 1 | defmodule Projector.Opts do 2 | @moduledoc """ 3 | Options Parsing. 4 | """ 5 | 6 | @typedoc "A list of args." 7 | @type args :: [String.t()] 8 | 9 | @typedoc "A string of args." 10 | @type argv :: String.t() 11 | 12 | @typedoc "A keyword list of the parsed args." 13 | @type parsed :: keyword() 14 | 15 | @doc """ 16 | Parse the options. Accepts a list or string of args. 17 | 18 | ## Examples 19 | 20 | iex> parse("-p /foo") 21 | {[pwd: "/foo"], []} 22 | 23 | iex> parse("-p /foo --command add") 24 | {[pwd: "/foo", command: "add"], []} 25 | 26 | """ 27 | @spec parse(argv() | args()) :: {parsed(), rest :: args()} 28 | def parse(argv) when is_binary(argv) do 29 | OptionParser.split(argv) |> parse() 30 | end 31 | 32 | def parse(args) when is_list(args) do 33 | OptionParser.parse!(args, 34 | strict: [ 35 | config: :string, 36 | pwd: :string, 37 | command: [:string, :keep] 38 | ], 39 | aliases: [ 40 | c: :config, 41 | p: :pwd 42 | ] 43 | ) 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /elixir/lib/projector/project.ex: -------------------------------------------------------------------------------- 1 | defmodule Projector.Project do 2 | @moduledoc """ 3 | Project struct and functions. 4 | """ 5 | 6 | alias __MODULE__ 7 | 8 | defstruct aliases: %{}, projects: %{} 9 | 10 | @type path :: String.t() 11 | 12 | @type key :: String.t() 13 | 14 | @type value :: String.t() 15 | 16 | @type t :: %Project{ 17 | aliases: %{optional(path()) => path()}, 18 | projects: %{ 19 | optional(path()) => %{ 20 | optional(key()) => value() 21 | } 22 | } 23 | } 24 | 25 | @doc """ 26 | Create a new `Project` struct from a map. 27 | 28 | ## Example 29 | 30 | iex> new!(%{projects: %{"foo" => %{"bar" => "baz"}}}) 31 | %Project{aliases: %{}, projects: %{"foo" => %{"bar" => "baz"}}} 32 | 33 | iex> new!() 34 | %Project{aliases: %{}, projects: %{}} 35 | 36 | """ 37 | @spec new!(map()) :: t() 38 | def new!(attrs \\ %{}) when is_map(attrs) do 39 | struct!(Project, attrs) 40 | end 41 | 42 | @doc """ 43 | Load the project from a file, if it exists. Returns an empty `%Project{}` if not. 44 | """ 45 | @spec load(path()) :: t() 46 | def load(config_path) do 47 | if File.exists?(config_path) do 48 | config_path 49 | |> File.read!() 50 | |> Jason.decode!() 51 | |> new!() 52 | else 53 | new!() 54 | end 55 | end 56 | 57 | @doc """ 58 | Get the value from the project for a specific path and key. 59 | 60 | ## Examples 61 | 62 | iex> project = new!(%{projects: %{"/foo" => %{"bar" => "baz"}}}) 63 | iex> get_value(project, "/foo", "bar") 64 | "baz" 65 | 66 | iex> project = new!(%{aliases: %{"/fizz" => "/foo"}, projects: %{"/foo" => %{"bar" => "baz"}}}) 67 | iex> get_value(project, "/fizz", "bar") 68 | "baz" 69 | 70 | iex> project = new!(%{projects: %{"/foo" => %{"bar" => "baz"}}}) 71 | iex> get_value(project, "/foo", "banana") 72 | nil 73 | 74 | """ 75 | @spec get_value(t(), path(), key()) :: value() | nil 76 | def get_value(%Project{} = project, path, key) do 77 | [root | paths] = Path.split(path) 78 | 79 | {_path, value} = 80 | Enum.reduce(paths, {root, nil}, fn dir, {parent, value} -> 81 | current_path = Path.join(parent, dir) 82 | current_path = Map.get(project.aliases, current_path, current_path) 83 | 84 | case get_in(project.projects, [current_path, key]) do 85 | nil -> {current_path, value} 86 | new_value -> {current_path, new_value} 87 | end 88 | end) 89 | 90 | value 91 | end 92 | 93 | @doc """ 94 | Put the value of the key in the project's path. 95 | 96 | ## Examples 97 | 98 | iex> put_value(new!(), "/foo", "bar", "baz") 99 | %Project{projects: %{"/foo" => %{"bar" => "baz"}}} 100 | 101 | iex> project = %Project{projects: %{"/foo" => %{"bar" => "baz"}}} 102 | iex> put_value(project, "/foo", "bar", "banana") 103 | %Project{projects: %{"/foo" => %{"bar" => "banana"}}} 104 | 105 | """ 106 | @spec put_value(t(), path(), key(), value()) :: t() 107 | def put_value(%Project{} = project, path, key, value) do 108 | %Project{ 109 | project 110 | | projects: put_in(project.projects, Enum.map([path, key], &Access.key(&1, %{})), value) 111 | } 112 | end 113 | 114 | @doc """ 115 | Delete the key/value pair of the key in the project's path. 116 | 117 | ## Example 118 | 119 | iex> project = %Project{projects: %{"/foo" => %{"bar" => "baz"}}} 120 | iex> delete(project, "/foo", "bar") 121 | %Project{projects: %{"/foo" => %{}}} 122 | 123 | """ 124 | @spec delete(t(), path(), key()) :: t() 125 | def delete(%Project{} = project, path, key) do 126 | %Project{project | projects: pop_in(project.projects, [path, key]) |> elem(1)} 127 | end 128 | 129 | @doc """ 130 | Delete the project path. 131 | 132 | ## Example 133 | 134 | iex> project = %Project{projects: %{"/foo" => %{"bar" => "baz"}}} 135 | iex> delete(project, "/foo") 136 | %Project{projects: %{}} 137 | 138 | """ 139 | @spec delete(t(), path()) :: t() 140 | def delete(%Project{} = project, path) do 141 | %Project{project | projects: Map.delete(project.projects, path)} 142 | end 143 | 144 | @doc """ 145 | Put the alias. 146 | 147 | ## Example 148 | 149 | iex> project = %Project{projects: %{"/foo" => %{"bar" => "baz"}}} 150 | iex> put_alias(project, "/fizz", "/foo") 151 | %Project{aliases: %{"/fizz" => "/foo"}, projects: %{"/foo" => %{"bar" => "baz"}}} 152 | 153 | """ 154 | @spec put_alias(t(), path(), path()) :: t() 155 | def put_alias(%Project{} = project, from_path, to_path) do 156 | %Project{project | aliases: Map.put(project.aliases, from_path, to_path)} 157 | end 158 | 159 | @doc """ 160 | Delete an alias. 161 | 162 | ## Example 163 | 164 | iex> project = %Project{aliases: %{"/fizz" => "/foo"}, projects: %{"/foo" => %{"bar" => "baz"}}} 165 | iex> delete_alias(project, "/fizz") 166 | %Project{aliases: %{}, projects: %{"/foo" => %{"bar" => "baz"}}} 167 | 168 | """ 169 | @spec delete_alias(t(), path()) :: t() 170 | def delete_alias(%Project{} = project, from_path) do 171 | %Project{project | aliases: Map.delete(project.aliases, from_path)} 172 | end 173 | end 174 | -------------------------------------------------------------------------------- /elixir/lib/projector/project_server.ex: -------------------------------------------------------------------------------- 1 | defmodule Projector.ProjectServer do 2 | @moduledoc """ 3 | Project Server. Uses [ETS](https://www.erlang.org/doc/man/ets.html) for 4 | in-memory KV store. 5 | 6 | Reads are concurrent and writes are serial. 7 | """ 8 | use GenServer 9 | 10 | alias Projector.Project 11 | 12 | @aliases_table :aliases 13 | @projects_table :projects 14 | 15 | # ---------------------------------------------------------------------------- 16 | # Public API 17 | # ---------------------------------------------------------------------------- 18 | 19 | @doc """ 20 | Start the Projector process and load the config. 21 | """ 22 | @spec start_link(String.t()) :: GenServer.on_start() 23 | def start_link(config_path) do 24 | GenServer.start_link(__MODULE__, config_path, name: __MODULE__) 25 | end 26 | 27 | @doc """ 28 | Get the value of a `key` for the `path`. 29 | 30 | Checks path first, and then checks for an alias. This allows you to use 31 | another project's config as a default, but override specific keys. 32 | 33 | Also recursively checks path aliases, in case you have aliases of aliases. 34 | """ 35 | @spec get_value(String.t(), String.t()) :: String.t() | nil 36 | def get_value(path, key) do 37 | case lookup_project(path, key) do 38 | nil -> 39 | path_alias = get_alias(path) 40 | path_alias && get_value(path_alias, key) 41 | 42 | value -> 43 | value 44 | end 45 | end 46 | 47 | @doc """ 48 | Add a value to the path and key. Replaces values, if exists. 49 | """ 50 | @spec add_value(String.t(), String.t(), String.t()) :: :ok 51 | def add_value(path, key, value) do 52 | GenServer.cast(__MODULE__, {:add_value, path, key, value}) 53 | end 54 | 55 | @doc """ 56 | Remove a value for the path and key. 57 | """ 58 | @spec remove_value(String.t(), String.t()) :: :ok 59 | def remove_value(path, key) do 60 | GenServer.cast(__MODULE__, {:remove_value, path, key}) 61 | end 62 | 63 | @doc """ 64 | Get the alias of the path if it exists. 65 | """ 66 | @spec get_alias(String.t()) :: String.t() | nil 67 | def get_alias(path) do 68 | lookup_alias(path) 69 | end 70 | 71 | @doc """ 72 | Add an alias. Replaces aliases, if exists. 73 | """ 74 | @spec add_alias(String.t(), String.t()) :: :ok | {:error, :path_not_found} 75 | def add_alias(path_from, path_to) do 76 | GenServer.call(__MODULE__, {:add_alias, path_from, path_to}) 77 | end 78 | 79 | @doc """ 80 | Remove an alias. 81 | """ 82 | @spec remove_alias(String.t()) :: :ok 83 | def remove_alias(path_from) do 84 | GenServer.cast(__MODULE__, {:remove_alias, path_from}) 85 | end 86 | 87 | # ---------------------------------------------------------------------------- 88 | # GenServer Callbacks 89 | # ---------------------------------------------------------------------------- 90 | 91 | @impl GenServer 92 | def init(config_path) do 93 | aliases = :ets.new(@aliases_table, [:named_table, read_concurrency: true]) 94 | projects = :ets.new(@projects_table, [:named_table, read_concurrency: true]) 95 | 96 | project = Project.load(config_path) 97 | load_ets_projects(projects, project.projects) 98 | load_ets_aliases(aliases, project.aliases) 99 | 100 | {:ok, {aliases, projects}} 101 | end 102 | 103 | @impl GenServer 104 | def handle_cast({:add_value, path, key, value}, {aliases, projects}) do 105 | :ets.insert(projects, {{path, key}, value}) 106 | {:noreply, {aliases, projects}} 107 | end 108 | 109 | def handle_cast({:remove_value, path, key}, {aliases, projects}) do 110 | :ets.delete(projects, {path, key}) 111 | {:noreply, {aliases, projects}} 112 | end 113 | 114 | def handle_cast({:remove_alias, path_from}, {aliases, projects}) do 115 | :ets.delete(aliases, path_from) 116 | {:noreply, {aliases, projects}} 117 | end 118 | 119 | @impl GenServer 120 | def handle_call({:add_alias, path_from, path_to}, _from, {aliases, projects}) do 121 | if has_path?(path_to) do 122 | :ets.insert(aliases, {path_from, path_to}) 123 | {:reply, :ok, {aliases, projects}} 124 | else 125 | {:reply, {:error, :path_not_found}, {aliases, projects}} 126 | end 127 | end 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Internal API 131 | # ---------------------------------------------------------------------------- 132 | 133 | defp lookup_project(path, key) do 134 | case :ets.lookup(@projects_table, {path, key}) do 135 | [{{_path, _key}, value}] -> value 136 | _ -> nil 137 | end 138 | end 139 | 140 | defp lookup_alias(path) do 141 | case :ets.lookup(@aliases_table, path) do 142 | [{^path, path_alias}] -> path_alias 143 | _ -> nil 144 | end 145 | end 146 | 147 | defp has_path?(path) do 148 | case :ets.match(@projects_table, {{path, '_'}, '_'}, 1) do 149 | {[[{{^path, _}, _}]], _} -> true 150 | _ -> false 151 | end 152 | end 153 | 154 | defp load_ets_projects(table, projects) do 155 | for {path, config} <- projects, {key, value} <- config do 156 | :ets.insert(table, {{path, key}, value}) 157 | end 158 | end 159 | 160 | defp load_ets_aliases(table, aliases) do 161 | :ets.insert(table, Map.to_list(aliases)) 162 | end 163 | end 164 | -------------------------------------------------------------------------------- /elixir/lib/projector_web.ex: -------------------------------------------------------------------------------- 1 | defmodule ProjectorWeb do 2 | @moduledoc """ 3 | Documentation for `Projector.Web`. 4 | """ 5 | 6 | @behaviour Plug 7 | 8 | import Plug.Conn 9 | 10 | @doc """ 11 | A required callback that we don't need. The processed `opts` returned here 12 | gets passed to the `call/2` function as the second argument. 13 | """ 14 | @impl Plug 15 | def init(opts), do: opts 16 | 17 | @doc """ 18 | Handle the shiz. 19 | """ 20 | @impl Plug 21 | def call(conn, _opts) do 22 | send_resp(conn, 200, "Hello world!") 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /elixir/lib/projector_web/router.ex: -------------------------------------------------------------------------------- 1 | defmodule ProjectorWeb.Router do 2 | use Plug.Router 3 | 4 | plug(Plug.Logger) 5 | plug(:match) 6 | plug(:dispatch) 7 | 8 | get("/hello", to: ProjectorWeb) 9 | 10 | match _ do 11 | send_resp(conn, 404, "!found") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /elixir/mix.exs: -------------------------------------------------------------------------------- 1 | defmodule Projector.MixProject do 2 | use Mix.Project 3 | 4 | def project do 5 | [ 6 | app: :projector, 7 | version: "0.1.0", 8 | elixir: "~> 1.13", 9 | start_permanent: Mix.env() == :prod, 10 | deps: deps() 11 | ] 12 | end 13 | 14 | # Run "mix help compile.app" to learn about applications. 15 | def application do 16 | [ 17 | extra_applications: [:logger], 18 | mod: {Projector.Application, []} 19 | ] 20 | end 21 | 22 | # Run "mix help deps" to learn about dependencies. 23 | defp deps do 24 | [ 25 | {:jason, "~> 1.3.0"}, 26 | {:plug_cowboy, "~> 2.0"} 27 | ] 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /elixir/mix.lock: -------------------------------------------------------------------------------- 1 | %{ 2 | "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, 3 | "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, 4 | "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, 5 | "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, 6 | "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, 7 | "plug": {:hex, :plug, "1.13.4", "addb6e125347226e3b11489e23d22a60f7ab74786befb86c14f94fb5f23ca9a4", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "06114c1f2a334212fe3ae567dbb3b1d29fd492c1a09783d52f3d489c1a6f4cf2"}, 8 | "plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"}, 9 | "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, 10 | "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, 11 | "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, 12 | } 13 | -------------------------------------------------------------------------------- /elixir/test/projector/opts_test.exs: -------------------------------------------------------------------------------- 1 | defmodule Projector.OptsTest do 2 | use ExUnit.Case, async: true 3 | 4 | alias Projector.Opts 5 | 6 | doctest Opts, import: true 7 | end 8 | -------------------------------------------------------------------------------- /elixir/test/projector/project_test.exs: -------------------------------------------------------------------------------- 1 | defmodule Projector.ProjectTest do 2 | use ExUnit.Case, async: true 3 | 4 | alias Projector.Project 5 | 6 | doctest Project, import: true 7 | end 8 | -------------------------------------------------------------------------------- /elixir/test/projector_test.exs: -------------------------------------------------------------------------------- 1 | defmodule ProjectorTest do 2 | use ExUnit.Case 3 | 4 | doctest Projector, import: true 5 | end 6 | -------------------------------------------------------------------------------- /elixir/test/test_helper.exs: -------------------------------------------------------------------------------- 1 | ExUnit.start() 2 | -------------------------------------------------------------------------------- /go/cmd/projector/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "os" 6 | 7 | config "github.com/ThePrimeagen/throbbing-judos/pkg/config" 8 | "github.com/ThePrimeagen/throbbing-judos/pkg/projector" 9 | "github.com/urfave/cli/v2" 10 | ) 11 | 12 | var flags []cli.Flag 13 | func init() { 14 | flags = []cli.Flag{ 15 | &cli.StringFlag{ 16 | Name: "config", 17 | Value: "", 18 | Usage: "path to a config to use, default will be XDG_CONFIG or HOME.", 19 | }, 20 | &cli.StringFlag{ 21 | Name: "pwd", 22 | Value: "", 23 | Usage: "what directory to execute projector from.", 24 | }, 25 | } 26 | } 27 | 28 | func generateAction(name, from string) func(*cli.Context) error { 29 | return func(c *cli.Context) error { 30 | cfg, err := config.NewConfig(name, c) 31 | if err != nil { 32 | return err 33 | } 34 | 35 | log.Printf("generateAction(%v) %v", from, cfg) 36 | projector.Projector(cfg) 37 | return nil; 38 | } 39 | } 40 | 41 | func generateCommand(name string) *cli.Command { 42 | return &cli.Command { 43 | Name: name, 44 | Flags: flags, 45 | Action: generateAction(name, "generateCommand"), 46 | } 47 | } 48 | 49 | func main() { 50 | app := &cli.App{ 51 | Commands: []*cli.Command{ 52 | generateCommand("print"), 53 | generateCommand("add"), 54 | generateCommand("rm"), 55 | generateCommand("link"), 56 | generateCommand("unlink"), 57 | }, 58 | Flags: flags, 59 | Action: generateAction("print", "mainfunc"), 60 | } 61 | 62 | err := app.Run(os.Args) 63 | if err != nil { 64 | log.Fatal(err) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /go/cmd/web.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/gofiber/fiber/v2" 4 | 5 | func main() { 6 | app := fiber.New() 7 | 8 | // This route path will match requests to the root route, "/": 9 | app.Get("/", func(c *fiber.Ctx) error { 10 | return c.SendString("root") 11 | }) 12 | 13 | // This route path will match requests to "/about": 14 | app.Get("/about", func(c *fiber.Ctx) error { 15 | return c.SendString("about") 16 | }) 17 | 18 | // This route path will match requests to "/random.txt": 19 | app.Get("/random.txt", func(c *fiber.Ctx) error { 20 | return c.SendString("random.txt") 21 | }) 22 | 23 | app.Listen(":8080") 24 | } 25 | 26 | -------------------------------------------------------------------------------- /go/cmd/web/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/gofiber/fiber/v2" 4 | 5 | func main() { 6 | app := fiber.New() 7 | 8 | // This route path will match requests to the root route, "/": 9 | app.Get("/", func(c *fiber.Ctx) error { 10 | return c.SendString("root") 11 | }) 12 | 13 | // This route path will match requests to "/about": 14 | app.Get("/about", func(c *fiber.Ctx) error { 15 | return c.SendString("about") 16 | }) 17 | 18 | // This route path will match requests to "/random.txt": 19 | app.Get("/random.txt", func(c *fiber.Ctx) error { 20 | return c.SendString("random.txt") 21 | }) 22 | 23 | app.Listen(":8080") 24 | } 25 | 26 | -------------------------------------------------------------------------------- /go/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/ThePrimeagen/throbbing-judos 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/gofiber/fiber/v2 v2.31.0 7 | github.com/urfave/cli/v2 v2.4.0 8 | ) 9 | 10 | require ( 11 | github.com/andybalholm/brotli v1.0.4 // indirect 12 | github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect 13 | github.com/klauspost/compress v1.15.0 // indirect 14 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 15 | github.com/valyala/bytebufferpool v1.0.0 // indirect 16 | github.com/valyala/fasthttp v1.34.0 // indirect 17 | github.com/valyala/tcplisten v1.0.0 // indirect 18 | golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /go/go.sum: -------------------------------------------------------------------------------- 1 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 | github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= 3 | github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= 4 | github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= 5 | github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 6 | github.com/gofiber/fiber/v2 v2.31.0 h1:M2rWPQbD5fDVAjcoOLjKRXTIlHesI5Eq7I5FEQPt4Ow= 7 | github.com/gofiber/fiber/v2 v2.31.0/go.mod h1:1Ega6O199a3Y7yDGuM9FyXDPYQfv+7/y48wl6WCwUF4= 8 | github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwcyL6U= 9 | github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 10 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 11 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 12 | github.com/urfave/cli/v2 v2.4.0 h1:m2pxjjDFgDxSPtO8WSdbndj17Wu2y8vOT86wE/tjr+I= 13 | github.com/urfave/cli/v2 v2.4.0/go.mod h1:NX9W0zmTvedE5oDoOMs2RTC8RvdK98NTYZE5LbaEYPg= 14 | github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= 15 | github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= 16 | github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGGm4= 17 | github.com/valyala/fasthttp v1.34.0/go.mod h1:epZA5N+7pY6ZaEKRmstzOuYJx9HI8DI1oaCGZpdH4h0= 18 | github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= 19 | github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= 20 | golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 21 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 22 | golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 23 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 24 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 25 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 26 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 27 | golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= 28 | golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 29 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 30 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 31 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 32 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 33 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 34 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 35 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 36 | -------------------------------------------------------------------------------- /go/pkg/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "encoding/json" 5 | "io/ioutil" 6 | "log" 7 | "os" 8 | "path/filepath" 9 | 10 | "github.com/urfave/cli/v2" 11 | ) 12 | 13 | type Opts interface { 14 | String(string) string 15 | Args() cli.Args 16 | } 17 | 18 | type Operation int 19 | 20 | const ( 21 | Add Operation = iota 22 | Remove 23 | Link 24 | Unlink 25 | Print 26 | ) 27 | 28 | type ProjectorConfig struct { 29 | Pwd string 30 | Config *Config 31 | 32 | Operation Operation 33 | Terms []string 34 | } 35 | 36 | type MapOfStrings = map[string]string 37 | type Config struct { 38 | Links map[string][]string `json:"links"` 39 | Projector map[string]MapOfStrings `json:"projector"` 40 | } 41 | 42 | func (c *Config) AddValue(pwd, key, value string) { 43 | var path MapOfStrings 44 | if _, found := c.Projector[pwd]; !found { 45 | c.Projector[pwd] = map[string]string{} 46 | path = c.Projector[pwd] 47 | } 48 | 49 | path[key] = value 50 | } 51 | 52 | func (c *Config) RemoveValue(pwd, key string) { 53 | hashMap, found := c.Projector[pwd] 54 | if !found { 55 | return; 56 | } 57 | 58 | delete(hashMap, key) 59 | } 60 | 61 | func (c *Config) getValue(pwd, key string) (string, bool) { 62 | if _, ok := c.Projector[pwd]; !ok { 63 | return "", false 64 | } 65 | 66 | val, ok := c.Projector[pwd][key] 67 | return val, ok 68 | } 69 | 70 | func (c *Config) GetValue(pwd, key string) (string, bool) { 71 | for { 72 | if val, ok := c.getValue(pwd, key); ok { 73 | return val, true 74 | } 75 | 76 | pwd_next := filepath.Dir(pwd) 77 | if pwd == pwd_next { 78 | break 79 | } 80 | 81 | pwd = pwd_next 82 | } 83 | 84 | if linkSet, ok := c.Links[pwd]; ok { 85 | for _, link := range linkSet { 86 | if val, ok := c.getValue(link, key); ok { 87 | return val, true 88 | } 89 | } 90 | } 91 | 92 | return "", false 93 | } 94 | 95 | func getConfigFromFile(path string) (*Config, error) { 96 | if _, err := os.Stat(path); os.IsNotExist(err) { 97 | { 98 | f, err := os.Create(path) 99 | if err != nil { 100 | return nil, err 101 | } 102 | defer func() { 103 | log.Println("Defer"); 104 | f.Close() 105 | }() 106 | 107 | _, err = f.WriteString("{\"links\": {}, \"projector\": {}}\n") 108 | if err != nil { 109 | return nil, err 110 | } 111 | 112 | f.Sync() 113 | } 114 | log.Println("Post Defer"); 115 | } 116 | 117 | content, err := ioutil.ReadFile(path) 118 | if err != nil { 119 | return nil, err 120 | } 121 | 122 | var config Config 123 | json.Unmarshal(content, &config) 124 | 125 | return &config, nil 126 | } 127 | 128 | func nameToOperation(cmd string) Operation { 129 | switch (cmd) { 130 | case "add": return Add 131 | case "rm": return Remove 132 | case "link": return Link 133 | case "unlink": return Unlink 134 | } 135 | return Print 136 | } 137 | 138 | func getPWDPath(pwd string) (string, error) { 139 | if pwd == "" { 140 | oswd, err := os.Getwd() 141 | if err != nil { 142 | return "", err 143 | } 144 | 145 | pwd = oswd 146 | } 147 | 148 | return pwd, nil 149 | } 150 | 151 | func getConfigPath(config string) (string, error) { 152 | if config == "" { 153 | configHome, err := os.UserConfigDir() 154 | if err != nil { 155 | return "", err 156 | } 157 | config = configHome 158 | } 159 | 160 | return config, nil 161 | } 162 | 163 | func NewConfig(cmd string, opts Opts) (*ProjectorConfig, error) { 164 | pwd, err := getPWDPath(opts.String("pwd")) 165 | if err != nil { 166 | return nil, err 167 | } 168 | 169 | config, err := getConfigPath(opts.String("config")) 170 | if err != nil { 171 | return nil, err 172 | } 173 | 174 | cfg, err := getConfigFromFile(config) 175 | if err != nil { 176 | log.Fatalf("Unable to read config file: %+v\n", err) 177 | } 178 | 179 | return &ProjectorConfig { 180 | Pwd: pwd, 181 | Config: cfg, 182 | Operation: nameToOperation(cmd), 183 | Terms: opts.Args().Tail(), 184 | }, nil 185 | } 186 | -------------------------------------------------------------------------------- /go/pkg/config/config_test.go: -------------------------------------------------------------------------------- 1 | package config_test 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/ThePrimeagen/throbbing-judos/pkg/config" 8 | ) 9 | 10 | func TestGetConfigPathDefault(t *testing.T) { 11 | 12 | foundConfig, err := config.Config_getConfigPath("") 13 | 14 | if err != nil { 15 | t.Errorf("did not expect an error %v", err) 16 | } 17 | 18 | configHome, err := os.UserConfigDir() 19 | 20 | if err != nil { 21 | t.Errorf("did not expect an error %v", err) 22 | } 23 | 24 | if foundConfig != configHome { 25 | t.Errorf("expected pwd == configHome and it didnt %s == %s", foundConfig, configHome) 26 | } 27 | } 28 | 29 | func TestGetConfigPathProvided(t *testing.T) { 30 | 31 | foundConfig, err := config.Config_getConfigPath("/foo") 32 | 33 | if err != nil { 34 | t.Errorf("did not expect an error %v", err) 35 | } 36 | 37 | if foundConfig != "/foo" { 38 | t.Errorf("expected pwd == configHome and it didnt %s == /foo", foundConfig) 39 | } 40 | } 41 | 42 | 43 | func TestGetConfigRemove(t *testing.T) { 44 | 45 | config := config.Config { 46 | Links: map[string][]string{}, 47 | Projector: map[string]map[string]string{}, 48 | } 49 | 50 | path := "/foo/bar" 51 | config.AddValue(path, "baz", "theo"); 52 | value, found := config.GetValue(path, "baz") 53 | 54 | if !found { 55 | t.Errorf("Did not find the value baz") 56 | } 57 | 58 | if value != "theo" { 59 | t.Errorf("Expected %v to equal \"theo\"", value) 60 | } 61 | } 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /go/pkg/config/export_test.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | var Config_getConfigPath = getConfigPath 4 | var Config_getPWDPath = getPWDPath 5 | 6 | -------------------------------------------------------------------------------- /go/pkg/projector/projector.go: -------------------------------------------------------------------------------- 1 | package projector 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ThePrimeagen/throbbing-judos/pkg/config" 7 | ) 8 | 9 | func add(cfg *config.ProjectorConfig) error { 10 | 11 | if len(cfg.Terms) != 2 { 12 | return fmt.Errorf("invalid argument count (expected 2, found %v)", len(cfg.Terms)) 13 | } 14 | 15 | cfg.Config.AddValue(cfg.Pwd, cfg.Terms[0], cfg.Terms[1]) 16 | 17 | return nil 18 | } 19 | 20 | func remove(cfg *config.ProjectorConfig) error { 21 | 22 | if len(cfg.Terms) != 1 { 23 | return fmt.Errorf("invalid argument count (expected 2, found %v)", len(cfg.Terms)) 24 | } 25 | 26 | cfg.Config.RemoveValue(cfg.Pwd, cfg.Terms[0]) 27 | 28 | return nil 29 | } 30 | 31 | func Projector(cfg *config.ProjectorConfig) error { 32 | 33 | var err error 34 | switch cfg.Operation { 35 | case config.Add: err = add(cfg) 36 | case config.Remove: err = remove(cfg) 37 | } 38 | 39 | return err 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /go/pkg/projector/projector_test.go: -------------------------------------------------------------------------------- 1 | package projector_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/ThePrimeagen/throbbing-judos/pkg/config" 7 | "github.com/ThePrimeagen/throbbing-judos/pkg/projector" 8 | ) 9 | 10 | func TestProjectorAdd(t *testing.T) { 11 | pwd := "/foo/bar" 12 | cfg := &config.ProjectorConfig { 13 | Pwd: pwd, 14 | Config: &config.Config { 15 | Links: map[string][]string{}, 16 | Projector: map[string]map[string]string{}, 17 | }, 18 | Operation: config.Add, 19 | Terms: []string{"foo", "bar"}, 20 | } 21 | 22 | projector.Projector(cfg) 23 | 24 | value, ok := cfg.Config.GetValue(pwd, "foo") 25 | if !ok { 26 | t.Errorf("expected to find a value, but config responded with false") 27 | } 28 | 29 | if value != "bar" { 30 | t.Errorf("expected to find the value bar but found \"%v\"", value) 31 | } 32 | } 33 | 34 | func TestProjectorRemove(t *testing.T) { 35 | pwd := "/foo/bar" 36 | cfg := &config.ProjectorConfig { 37 | Pwd: pwd, 38 | Config: &config.Config { 39 | Links: map[string][]string{}, 40 | Projector: map[string]map[string]string{ 41 | pwd: { 42 | "foo": "bar", 43 | "baz": "thenamesty", 44 | }, 45 | }, 46 | }, 47 | Operation: config.Remove, 48 | Terms: []string{"foo"}, 49 | } 50 | 51 | foo, ok := cfg.Config.GetValue(pwd, "foo") 52 | if !ok { 53 | t.Errorf("expected to find a value, but config responded with false") 54 | } 55 | baz, ok := cfg.Config.GetValue(pwd, "baz") 56 | if !ok { 57 | t.Errorf("expected to find a value, but config responded with false") 58 | } 59 | 60 | if foo != "bar" { 61 | t.Errorf("expected to find the value bar but found \"%v\"", foo) 62 | } 63 | 64 | if baz != "thenamesty" { 65 | t.Errorf("expected to find the value bar but found \"%v\"", baz) 66 | } 67 | 68 | projector.Projector(cfg) 69 | _, ok = cfg.Config.GetValue(pwd, "foo") 70 | 71 | if ok { 72 | t.Errorf("expected to not find the value because it was deleted.") 73 | } 74 | } 75 | 76 | func TestProjectorRemoveBadArgs(t *testing.T) { 77 | pwd := "/foo/bar" 78 | cfg := &config.ProjectorConfig { 79 | Pwd: pwd, 80 | Config: &config.Config { 81 | Links: map[string][]string{}, 82 | Projector: map[string]map[string]string{ 83 | pwd: {}, 84 | }, 85 | }, 86 | Operation: config.Remove, 87 | Terms: []string{"foo", "foo2"}, 88 | } 89 | 90 | err := projector.Projector(cfg) 91 | if err == nil { 92 | t.Errorf("expected there to be an error because provided 2 arguments") 93 | } 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /rust/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /rust/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "actix-codec" 7 | version = "0.5.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe" 10 | dependencies = [ 11 | "bitflags", 12 | "bytes", 13 | "futures-core", 14 | "futures-sink", 15 | "log", 16 | "memchr", 17 | "pin-project-lite", 18 | "tokio", 19 | "tokio-util", 20 | ] 21 | 22 | [[package]] 23 | name = "actix-http" 24 | version = "3.0.4" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "a5885cb81a0d4d0d322864bea1bb6c2a8144626b4fdc625d4c51eba197e7797a" 27 | dependencies = [ 28 | "actix-codec", 29 | "actix-rt", 30 | "actix-service", 31 | "actix-utils", 32 | "ahash", 33 | "base64", 34 | "bitflags", 35 | "brotli", 36 | "bytes", 37 | "bytestring", 38 | "derive_more", 39 | "encoding_rs", 40 | "flate2", 41 | "futures-core", 42 | "h2", 43 | "http", 44 | "httparse", 45 | "httpdate", 46 | "itoa", 47 | "language-tags", 48 | "local-channel", 49 | "log", 50 | "mime", 51 | "percent-encoding", 52 | "pin-project-lite", 53 | "rand", 54 | "sha-1", 55 | "smallvec", 56 | "zstd", 57 | ] 58 | 59 | [[package]] 60 | name = "actix-macros" 61 | version = "0.2.3" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" 64 | dependencies = [ 65 | "quote", 66 | "syn", 67 | ] 68 | 69 | [[package]] 70 | name = "actix-router" 71 | version = "0.5.0" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "eb60846b52c118f2f04a56cc90880a274271c489b2498623d58176f8ca21fa80" 74 | dependencies = [ 75 | "bytestring", 76 | "firestorm", 77 | "http", 78 | "log", 79 | "regex", 80 | "serde", 81 | ] 82 | 83 | [[package]] 84 | name = "actix-rt" 85 | version = "2.7.0" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" 88 | dependencies = [ 89 | "futures-core", 90 | "tokio", 91 | ] 92 | 93 | [[package]] 94 | name = "actix-server" 95 | version = "2.1.1" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" 98 | dependencies = [ 99 | "actix-rt", 100 | "actix-service", 101 | "actix-utils", 102 | "futures-core", 103 | "futures-util", 104 | "mio", 105 | "num_cpus", 106 | "socket2", 107 | "tokio", 108 | "tracing", 109 | ] 110 | 111 | [[package]] 112 | name = "actix-service" 113 | version = "2.0.2" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" 116 | dependencies = [ 117 | "futures-core", 118 | "paste", 119 | "pin-project-lite", 120 | ] 121 | 122 | [[package]] 123 | name = "actix-utils" 124 | version = "3.0.0" 125 | source = "registry+https://github.com/rust-lang/crates.io-index" 126 | checksum = "e491cbaac2e7fc788dfff99ff48ef317e23b3cf63dbaf7aaab6418f40f92aa94" 127 | dependencies = [ 128 | "local-waker", 129 | "pin-project-lite", 130 | ] 131 | 132 | [[package]] 133 | name = "actix-web" 134 | version = "4.0.1" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "f4e5ebffd51d50df56a3ae0de0e59487340ca456f05dd0b90c0a7a6dd6a74d31" 137 | dependencies = [ 138 | "actix-codec", 139 | "actix-http", 140 | "actix-macros", 141 | "actix-router", 142 | "actix-rt", 143 | "actix-server", 144 | "actix-service", 145 | "actix-utils", 146 | "actix-web-codegen", 147 | "ahash", 148 | "bytes", 149 | "bytestring", 150 | "cfg-if", 151 | "cookie", 152 | "derive_more", 153 | "encoding_rs", 154 | "futures-core", 155 | "futures-util", 156 | "itoa", 157 | "language-tags", 158 | "log", 159 | "mime", 160 | "once_cell", 161 | "pin-project-lite", 162 | "regex", 163 | "serde", 164 | "serde_json", 165 | "serde_urlencoded", 166 | "smallvec", 167 | "socket2", 168 | "time", 169 | "url", 170 | ] 171 | 172 | [[package]] 173 | name = "actix-web-codegen" 174 | version = "4.0.0" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "7525bedf54704abb1d469e88d7e7e9226df73778798a69cea5022d53b2ae91bc" 177 | dependencies = [ 178 | "actix-router", 179 | "proc-macro2", 180 | "quote", 181 | "syn", 182 | ] 183 | 184 | [[package]] 185 | name = "adler" 186 | version = "1.0.2" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 189 | 190 | [[package]] 191 | name = "ahash" 192 | version = "0.7.6" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 195 | dependencies = [ 196 | "getrandom", 197 | "once_cell", 198 | "version_check", 199 | ] 200 | 201 | [[package]] 202 | name = "aho-corasick" 203 | version = "0.7.18" 204 | source = "registry+https://github.com/rust-lang/crates.io-index" 205 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" 206 | dependencies = [ 207 | "memchr", 208 | ] 209 | 210 | [[package]] 211 | name = "alloc-no-stdlib" 212 | version = "2.0.3" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3" 215 | 216 | [[package]] 217 | name = "alloc-stdlib" 218 | version = "0.2.1" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" 221 | dependencies = [ 222 | "alloc-no-stdlib", 223 | ] 224 | 225 | [[package]] 226 | name = "ansi_term" 227 | version = "0.12.1" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 230 | dependencies = [ 231 | "winapi", 232 | ] 233 | 234 | [[package]] 235 | name = "atty" 236 | version = "0.2.14" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 239 | dependencies = [ 240 | "hermit-abi", 241 | "libc", 242 | "winapi", 243 | ] 244 | 245 | [[package]] 246 | name = "autocfg" 247 | version = "1.1.0" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 250 | 251 | [[package]] 252 | name = "base64" 253 | version = "0.13.0" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 256 | 257 | [[package]] 258 | name = "bitflags" 259 | version = "1.3.2" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 262 | 263 | [[package]] 264 | name = "block-buffer" 265 | version = "0.10.2" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" 268 | dependencies = [ 269 | "generic-array", 270 | ] 271 | 272 | [[package]] 273 | name = "brotli" 274 | version = "3.3.4" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" 277 | dependencies = [ 278 | "alloc-no-stdlib", 279 | "alloc-stdlib", 280 | "brotli-decompressor", 281 | ] 282 | 283 | [[package]] 284 | name = "brotli-decompressor" 285 | version = "2.3.2" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" 288 | dependencies = [ 289 | "alloc-no-stdlib", 290 | "alloc-stdlib", 291 | ] 292 | 293 | [[package]] 294 | name = "bytes" 295 | version = "1.1.0" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" 298 | 299 | [[package]] 300 | name = "bytestring" 301 | version = "1.0.0" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" 304 | dependencies = [ 305 | "bytes", 306 | ] 307 | 308 | [[package]] 309 | name = "cc" 310 | version = "1.0.73" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 313 | dependencies = [ 314 | "jobserver", 315 | ] 316 | 317 | [[package]] 318 | name = "cfg-if" 319 | version = "1.0.0" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 322 | 323 | [[package]] 324 | name = "clap" 325 | version = "2.34.0" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 328 | dependencies = [ 329 | "ansi_term", 330 | "atty", 331 | "bitflags", 332 | "strsim", 333 | "textwrap", 334 | "unicode-width", 335 | "vec_map", 336 | ] 337 | 338 | [[package]] 339 | name = "convert_case" 340 | version = "0.4.0" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" 343 | 344 | [[package]] 345 | name = "cookie" 346 | version = "0.16.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05" 349 | dependencies = [ 350 | "percent-encoding", 351 | "time", 352 | "version_check", 353 | ] 354 | 355 | [[package]] 356 | name = "cpufeatures" 357 | version = "0.2.2" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" 360 | dependencies = [ 361 | "libc", 362 | ] 363 | 364 | [[package]] 365 | name = "crc32fast" 366 | version = "1.3.2" 367 | source = "registry+https://github.com/rust-lang/crates.io-index" 368 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 369 | dependencies = [ 370 | "cfg-if", 371 | ] 372 | 373 | [[package]] 374 | name = "crypto-common" 375 | version = "0.1.3" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" 378 | dependencies = [ 379 | "generic-array", 380 | "typenum", 381 | ] 382 | 383 | [[package]] 384 | name = "derive_more" 385 | version = "0.99.17" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" 388 | dependencies = [ 389 | "convert_case", 390 | "proc-macro2", 391 | "quote", 392 | "rustc_version", 393 | "syn", 394 | ] 395 | 396 | [[package]] 397 | name = "digest" 398 | version = "0.10.3" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" 401 | dependencies = [ 402 | "block-buffer", 403 | "crypto-common", 404 | ] 405 | 406 | [[package]] 407 | name = "dirs" 408 | version = "4.0.0" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" 411 | dependencies = [ 412 | "dirs-sys", 413 | ] 414 | 415 | [[package]] 416 | name = "dirs-sys" 417 | version = "0.3.7" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 420 | dependencies = [ 421 | "libc", 422 | "redox_users", 423 | "winapi", 424 | ] 425 | 426 | [[package]] 427 | name = "encoding_rs" 428 | version = "0.8.31" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" 431 | dependencies = [ 432 | "cfg-if", 433 | ] 434 | 435 | [[package]] 436 | name = "firestorm" 437 | version = "0.5.0" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "4d3d6188b8804df28032815ea256b6955c9625c24da7525f387a7af02fbb8f01" 440 | 441 | [[package]] 442 | name = "flate2" 443 | version = "1.0.22" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" 446 | dependencies = [ 447 | "cfg-if", 448 | "crc32fast", 449 | "libc", 450 | "miniz_oxide", 451 | ] 452 | 453 | [[package]] 454 | name = "fnv" 455 | version = "1.0.7" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 458 | 459 | [[package]] 460 | name = "form_urlencoded" 461 | version = "1.0.1" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 464 | dependencies = [ 465 | "matches", 466 | "percent-encoding", 467 | ] 468 | 469 | [[package]] 470 | name = "futures-core" 471 | version = "0.3.21" 472 | source = "registry+https://github.com/rust-lang/crates.io-index" 473 | checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" 474 | 475 | [[package]] 476 | name = "futures-sink" 477 | version = "0.3.21" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" 480 | 481 | [[package]] 482 | name = "futures-task" 483 | version = "0.3.21" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" 486 | 487 | [[package]] 488 | name = "futures-util" 489 | version = "0.3.21" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" 492 | dependencies = [ 493 | "futures-core", 494 | "futures-task", 495 | "pin-project-lite", 496 | "pin-utils", 497 | ] 498 | 499 | [[package]] 500 | name = "generic-array" 501 | version = "0.14.5" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" 504 | dependencies = [ 505 | "typenum", 506 | "version_check", 507 | ] 508 | 509 | [[package]] 510 | name = "getrandom" 511 | version = "0.2.6" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" 514 | dependencies = [ 515 | "cfg-if", 516 | "libc", 517 | "wasi 0.10.2+wasi-snapshot-preview1", 518 | ] 519 | 520 | [[package]] 521 | name = "h2" 522 | version = "0.3.13" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" 525 | dependencies = [ 526 | "bytes", 527 | "fnv", 528 | "futures-core", 529 | "futures-sink", 530 | "futures-util", 531 | "http", 532 | "indexmap", 533 | "slab", 534 | "tokio", 535 | "tokio-util", 536 | "tracing", 537 | ] 538 | 539 | [[package]] 540 | name = "hashbrown" 541 | version = "0.11.2" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 544 | 545 | [[package]] 546 | name = "heck" 547 | version = "0.3.3" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 550 | dependencies = [ 551 | "unicode-segmentation", 552 | ] 553 | 554 | [[package]] 555 | name = "hermit-abi" 556 | version = "0.1.19" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 559 | dependencies = [ 560 | "libc", 561 | ] 562 | 563 | [[package]] 564 | name = "http" 565 | version = "0.2.6" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" 568 | dependencies = [ 569 | "bytes", 570 | "fnv", 571 | "itoa", 572 | ] 573 | 574 | [[package]] 575 | name = "httparse" 576 | version = "1.6.0" 577 | source = "registry+https://github.com/rust-lang/crates.io-index" 578 | checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" 579 | 580 | [[package]] 581 | name = "httpdate" 582 | version = "1.0.2" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 585 | 586 | [[package]] 587 | name = "idna" 588 | version = "0.2.3" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 591 | dependencies = [ 592 | "matches", 593 | "unicode-bidi", 594 | "unicode-normalization", 595 | ] 596 | 597 | [[package]] 598 | name = "indexmap" 599 | version = "1.8.1" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" 602 | dependencies = [ 603 | "autocfg", 604 | "hashbrown", 605 | ] 606 | 607 | [[package]] 608 | name = "itoa" 609 | version = "1.0.1" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 612 | 613 | [[package]] 614 | name = "jobserver" 615 | version = "0.1.24" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" 618 | dependencies = [ 619 | "libc", 620 | ] 621 | 622 | [[package]] 623 | name = "language-tags" 624 | version = "0.3.2" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" 627 | 628 | [[package]] 629 | name = "lazy_static" 630 | version = "1.4.0" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 633 | 634 | [[package]] 635 | name = "libc" 636 | version = "0.2.121" 637 | source = "registry+https://github.com/rust-lang/crates.io-index" 638 | checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" 639 | 640 | [[package]] 641 | name = "local-channel" 642 | version = "0.1.2" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "6246c68cf195087205a0512559c97e15eaf95198bf0e206d662092cdcb03fe9f" 645 | dependencies = [ 646 | "futures-core", 647 | "futures-sink", 648 | "futures-util", 649 | "local-waker", 650 | ] 651 | 652 | [[package]] 653 | name = "local-waker" 654 | version = "0.1.2" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "902eb695eb0591864543cbfbf6d742510642a605a61fc5e97fe6ceb5a30ac4fb" 657 | 658 | [[package]] 659 | name = "lock_api" 660 | version = "0.4.7" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" 663 | dependencies = [ 664 | "autocfg", 665 | "scopeguard", 666 | ] 667 | 668 | [[package]] 669 | name = "log" 670 | version = "0.4.16" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" 673 | dependencies = [ 674 | "cfg-if", 675 | ] 676 | 677 | [[package]] 678 | name = "matches" 679 | version = "0.1.9" 680 | source = "registry+https://github.com/rust-lang/crates.io-index" 681 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 682 | 683 | [[package]] 684 | name = "memchr" 685 | version = "2.4.1" 686 | source = "registry+https://github.com/rust-lang/crates.io-index" 687 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 688 | 689 | [[package]] 690 | name = "mime" 691 | version = "0.3.16" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 694 | 695 | [[package]] 696 | name = "miniz_oxide" 697 | version = "0.4.4" 698 | source = "registry+https://github.com/rust-lang/crates.io-index" 699 | checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" 700 | dependencies = [ 701 | "adler", 702 | "autocfg", 703 | ] 704 | 705 | [[package]] 706 | name = "mio" 707 | version = "0.8.2" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" 710 | dependencies = [ 711 | "libc", 712 | "log", 713 | "miow", 714 | "ntapi", 715 | "wasi 0.11.0+wasi-snapshot-preview1", 716 | "winapi", 717 | ] 718 | 719 | [[package]] 720 | name = "miow" 721 | version = "0.3.7" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 724 | dependencies = [ 725 | "winapi", 726 | ] 727 | 728 | [[package]] 729 | name = "ntapi" 730 | version = "0.3.7" 731 | source = "registry+https://github.com/rust-lang/crates.io-index" 732 | checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" 733 | dependencies = [ 734 | "winapi", 735 | ] 736 | 737 | [[package]] 738 | name = "num_cpus" 739 | version = "1.13.1" 740 | source = "registry+https://github.com/rust-lang/crates.io-index" 741 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 742 | dependencies = [ 743 | "hermit-abi", 744 | "libc", 745 | ] 746 | 747 | [[package]] 748 | name = "num_threads" 749 | version = "0.1.5" 750 | source = "registry+https://github.com/rust-lang/crates.io-index" 751 | checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0" 752 | dependencies = [ 753 | "libc", 754 | ] 755 | 756 | [[package]] 757 | name = "once_cell" 758 | version = "1.10.0" 759 | source = "registry+https://github.com/rust-lang/crates.io-index" 760 | checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" 761 | 762 | [[package]] 763 | name = "parking_lot" 764 | version = "0.12.0" 765 | source = "registry+https://github.com/rust-lang/crates.io-index" 766 | checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" 767 | dependencies = [ 768 | "lock_api", 769 | "parking_lot_core", 770 | ] 771 | 772 | [[package]] 773 | name = "parking_lot_core" 774 | version = "0.9.2" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" 777 | dependencies = [ 778 | "cfg-if", 779 | "libc", 780 | "redox_syscall", 781 | "smallvec", 782 | "windows-sys", 783 | ] 784 | 785 | [[package]] 786 | name = "paste" 787 | version = "1.0.7" 788 | source = "registry+https://github.com/rust-lang/crates.io-index" 789 | checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" 790 | 791 | [[package]] 792 | name = "percent-encoding" 793 | version = "2.1.0" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 796 | 797 | [[package]] 798 | name = "pin-project-lite" 799 | version = "0.2.8" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" 802 | 803 | [[package]] 804 | name = "pin-utils" 805 | version = "0.1.0" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 808 | 809 | [[package]] 810 | name = "ppv-lite86" 811 | version = "0.2.16" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 814 | 815 | [[package]] 816 | name = "proc-macro-error" 817 | version = "1.0.4" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 820 | dependencies = [ 821 | "proc-macro-error-attr", 822 | "proc-macro2", 823 | "quote", 824 | "syn", 825 | "version_check", 826 | ] 827 | 828 | [[package]] 829 | name = "proc-macro-error-attr" 830 | version = "1.0.4" 831 | source = "registry+https://github.com/rust-lang/crates.io-index" 832 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 833 | dependencies = [ 834 | "proc-macro2", 835 | "quote", 836 | "version_check", 837 | ] 838 | 839 | [[package]] 840 | name = "proc-macro2" 841 | version = "1.0.36" 842 | source = "registry+https://github.com/rust-lang/crates.io-index" 843 | checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" 844 | dependencies = [ 845 | "unicode-xid", 846 | ] 847 | 848 | [[package]] 849 | name = "projector" 850 | version = "0.1.0" 851 | dependencies = [ 852 | "actix-web", 853 | "serde", 854 | "serde_json", 855 | "structopt", 856 | "thiserror", 857 | "xdg", 858 | ] 859 | 860 | [[package]] 861 | name = "quote" 862 | version = "1.0.17" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" 865 | dependencies = [ 866 | "proc-macro2", 867 | ] 868 | 869 | [[package]] 870 | name = "rand" 871 | version = "0.8.5" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 874 | dependencies = [ 875 | "libc", 876 | "rand_chacha", 877 | "rand_core", 878 | ] 879 | 880 | [[package]] 881 | name = "rand_chacha" 882 | version = "0.3.1" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 885 | dependencies = [ 886 | "ppv-lite86", 887 | "rand_core", 888 | ] 889 | 890 | [[package]] 891 | name = "rand_core" 892 | version = "0.6.3" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 895 | dependencies = [ 896 | "getrandom", 897 | ] 898 | 899 | [[package]] 900 | name = "redox_syscall" 901 | version = "0.2.13" 902 | source = "registry+https://github.com/rust-lang/crates.io-index" 903 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" 904 | dependencies = [ 905 | "bitflags", 906 | ] 907 | 908 | [[package]] 909 | name = "redox_users" 910 | version = "0.4.3" 911 | source = "registry+https://github.com/rust-lang/crates.io-index" 912 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 913 | dependencies = [ 914 | "getrandom", 915 | "redox_syscall", 916 | "thiserror", 917 | ] 918 | 919 | [[package]] 920 | name = "regex" 921 | version = "1.5.5" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" 924 | dependencies = [ 925 | "aho-corasick", 926 | "memchr", 927 | "regex-syntax", 928 | ] 929 | 930 | [[package]] 931 | name = "regex-syntax" 932 | version = "0.6.25" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" 935 | 936 | [[package]] 937 | name = "rustc_version" 938 | version = "0.4.0" 939 | source = "registry+https://github.com/rust-lang/crates.io-index" 940 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 941 | dependencies = [ 942 | "semver", 943 | ] 944 | 945 | [[package]] 946 | name = "ryu" 947 | version = "1.0.9" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" 950 | 951 | [[package]] 952 | name = "scopeguard" 953 | version = "1.1.0" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 956 | 957 | [[package]] 958 | name = "semver" 959 | version = "1.0.7" 960 | source = "registry+https://github.com/rust-lang/crates.io-index" 961 | checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" 962 | 963 | [[package]] 964 | name = "serde" 965 | version = "1.0.136" 966 | source = "registry+https://github.com/rust-lang/crates.io-index" 967 | checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" 968 | dependencies = [ 969 | "serde_derive", 970 | ] 971 | 972 | [[package]] 973 | name = "serde_derive" 974 | version = "1.0.136" 975 | source = "registry+https://github.com/rust-lang/crates.io-index" 976 | checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" 977 | dependencies = [ 978 | "proc-macro2", 979 | "quote", 980 | "syn", 981 | ] 982 | 983 | [[package]] 984 | name = "serde_json" 985 | version = "1.0.79" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" 988 | dependencies = [ 989 | "itoa", 990 | "ryu", 991 | "serde", 992 | ] 993 | 994 | [[package]] 995 | name = "serde_urlencoded" 996 | version = "0.7.1" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 999 | dependencies = [ 1000 | "form_urlencoded", 1001 | "itoa", 1002 | "ryu", 1003 | "serde", 1004 | ] 1005 | 1006 | [[package]] 1007 | name = "sha-1" 1008 | version = "0.10.0" 1009 | source = "registry+https://github.com/rust-lang/crates.io-index" 1010 | checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" 1011 | dependencies = [ 1012 | "cfg-if", 1013 | "cpufeatures", 1014 | "digest", 1015 | ] 1016 | 1017 | [[package]] 1018 | name = "signal-hook-registry" 1019 | version = "1.4.0" 1020 | source = "registry+https://github.com/rust-lang/crates.io-index" 1021 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" 1022 | dependencies = [ 1023 | "libc", 1024 | ] 1025 | 1026 | [[package]] 1027 | name = "slab" 1028 | version = "0.4.6" 1029 | source = "registry+https://github.com/rust-lang/crates.io-index" 1030 | checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" 1031 | 1032 | [[package]] 1033 | name = "smallvec" 1034 | version = "1.8.0" 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" 1036 | checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" 1037 | 1038 | [[package]] 1039 | name = "socket2" 1040 | version = "0.4.4" 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" 1042 | checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" 1043 | dependencies = [ 1044 | "libc", 1045 | "winapi", 1046 | ] 1047 | 1048 | [[package]] 1049 | name = "strsim" 1050 | version = "0.8.0" 1051 | source = "registry+https://github.com/rust-lang/crates.io-index" 1052 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 1053 | 1054 | [[package]] 1055 | name = "structopt" 1056 | version = "0.3.26" 1057 | source = "registry+https://github.com/rust-lang/crates.io-index" 1058 | checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" 1059 | dependencies = [ 1060 | "clap", 1061 | "lazy_static", 1062 | "structopt-derive", 1063 | ] 1064 | 1065 | [[package]] 1066 | name = "structopt-derive" 1067 | version = "0.4.18" 1068 | source = "registry+https://github.com/rust-lang/crates.io-index" 1069 | checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" 1070 | dependencies = [ 1071 | "heck", 1072 | "proc-macro-error", 1073 | "proc-macro2", 1074 | "quote", 1075 | "syn", 1076 | ] 1077 | 1078 | [[package]] 1079 | name = "syn" 1080 | version = "1.0.90" 1081 | source = "registry+https://github.com/rust-lang/crates.io-index" 1082 | checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" 1083 | dependencies = [ 1084 | "proc-macro2", 1085 | "quote", 1086 | "unicode-xid", 1087 | ] 1088 | 1089 | [[package]] 1090 | name = "textwrap" 1091 | version = "0.11.0" 1092 | source = "registry+https://github.com/rust-lang/crates.io-index" 1093 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 1094 | dependencies = [ 1095 | "unicode-width", 1096 | ] 1097 | 1098 | [[package]] 1099 | name = "thiserror" 1100 | version = "1.0.30" 1101 | source = "registry+https://github.com/rust-lang/crates.io-index" 1102 | checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" 1103 | dependencies = [ 1104 | "thiserror-impl", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "thiserror-impl" 1109 | version = "1.0.30" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" 1112 | dependencies = [ 1113 | "proc-macro2", 1114 | "quote", 1115 | "syn", 1116 | ] 1117 | 1118 | [[package]] 1119 | name = "time" 1120 | version = "0.3.9" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" 1123 | dependencies = [ 1124 | "itoa", 1125 | "libc", 1126 | "num_threads", 1127 | "time-macros", 1128 | ] 1129 | 1130 | [[package]] 1131 | name = "time-macros" 1132 | version = "0.2.4" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" 1135 | 1136 | [[package]] 1137 | name = "tinyvec" 1138 | version = "1.5.1" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" 1141 | dependencies = [ 1142 | "tinyvec_macros", 1143 | ] 1144 | 1145 | [[package]] 1146 | name = "tinyvec_macros" 1147 | version = "0.1.0" 1148 | source = "registry+https://github.com/rust-lang/crates.io-index" 1149 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1150 | 1151 | [[package]] 1152 | name = "tokio" 1153 | version = "1.17.0" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" 1156 | dependencies = [ 1157 | "bytes", 1158 | "libc", 1159 | "memchr", 1160 | "mio", 1161 | "once_cell", 1162 | "parking_lot", 1163 | "pin-project-lite", 1164 | "signal-hook-registry", 1165 | "socket2", 1166 | "winapi", 1167 | ] 1168 | 1169 | [[package]] 1170 | name = "tokio-util" 1171 | version = "0.7.1" 1172 | source = "registry+https://github.com/rust-lang/crates.io-index" 1173 | checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" 1174 | dependencies = [ 1175 | "bytes", 1176 | "futures-core", 1177 | "futures-sink", 1178 | "pin-project-lite", 1179 | "tokio", 1180 | "tracing", 1181 | ] 1182 | 1183 | [[package]] 1184 | name = "tracing" 1185 | version = "0.1.32" 1186 | source = "registry+https://github.com/rust-lang/crates.io-index" 1187 | checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" 1188 | dependencies = [ 1189 | "cfg-if", 1190 | "log", 1191 | "pin-project-lite", 1192 | "tracing-attributes", 1193 | "tracing-core", 1194 | ] 1195 | 1196 | [[package]] 1197 | name = "tracing-attributes" 1198 | version = "0.1.20" 1199 | source = "registry+https://github.com/rust-lang/crates.io-index" 1200 | checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" 1201 | dependencies = [ 1202 | "proc-macro2", 1203 | "quote", 1204 | "syn", 1205 | ] 1206 | 1207 | [[package]] 1208 | name = "tracing-core" 1209 | version = "0.1.24" 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" 1211 | checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee" 1212 | dependencies = [ 1213 | "lazy_static", 1214 | ] 1215 | 1216 | [[package]] 1217 | name = "typenum" 1218 | version = "1.15.0" 1219 | source = "registry+https://github.com/rust-lang/crates.io-index" 1220 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 1221 | 1222 | [[package]] 1223 | name = "unicode-bidi" 1224 | version = "0.3.7" 1225 | source = "registry+https://github.com/rust-lang/crates.io-index" 1226 | checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" 1227 | 1228 | [[package]] 1229 | name = "unicode-normalization" 1230 | version = "0.1.19" 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" 1232 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 1233 | dependencies = [ 1234 | "tinyvec", 1235 | ] 1236 | 1237 | [[package]] 1238 | name = "unicode-segmentation" 1239 | version = "1.9.0" 1240 | source = "registry+https://github.com/rust-lang/crates.io-index" 1241 | checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" 1242 | 1243 | [[package]] 1244 | name = "unicode-width" 1245 | version = "0.1.9" 1246 | source = "registry+https://github.com/rust-lang/crates.io-index" 1247 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 1248 | 1249 | [[package]] 1250 | name = "unicode-xid" 1251 | version = "0.2.2" 1252 | source = "registry+https://github.com/rust-lang/crates.io-index" 1253 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 1254 | 1255 | [[package]] 1256 | name = "url" 1257 | version = "2.2.2" 1258 | source = "registry+https://github.com/rust-lang/crates.io-index" 1259 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 1260 | dependencies = [ 1261 | "form_urlencoded", 1262 | "idna", 1263 | "matches", 1264 | "percent-encoding", 1265 | ] 1266 | 1267 | [[package]] 1268 | name = "vec_map" 1269 | version = "0.8.2" 1270 | source = "registry+https://github.com/rust-lang/crates.io-index" 1271 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 1272 | 1273 | [[package]] 1274 | name = "version_check" 1275 | version = "0.9.4" 1276 | source = "registry+https://github.com/rust-lang/crates.io-index" 1277 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1278 | 1279 | [[package]] 1280 | name = "wasi" 1281 | version = "0.10.2+wasi-snapshot-preview1" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 1284 | 1285 | [[package]] 1286 | name = "wasi" 1287 | version = "0.11.0+wasi-snapshot-preview1" 1288 | source = "registry+https://github.com/rust-lang/crates.io-index" 1289 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1290 | 1291 | [[package]] 1292 | name = "winapi" 1293 | version = "0.3.9" 1294 | source = "registry+https://github.com/rust-lang/crates.io-index" 1295 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1296 | dependencies = [ 1297 | "winapi-i686-pc-windows-gnu", 1298 | "winapi-x86_64-pc-windows-gnu", 1299 | ] 1300 | 1301 | [[package]] 1302 | name = "winapi-i686-pc-windows-gnu" 1303 | version = "0.4.0" 1304 | source = "registry+https://github.com/rust-lang/crates.io-index" 1305 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1306 | 1307 | [[package]] 1308 | name = "winapi-x86_64-pc-windows-gnu" 1309 | version = "0.4.0" 1310 | source = "registry+https://github.com/rust-lang/crates.io-index" 1311 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1312 | 1313 | [[package]] 1314 | name = "windows-sys" 1315 | version = "0.34.0" 1316 | source = "registry+https://github.com/rust-lang/crates.io-index" 1317 | checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" 1318 | dependencies = [ 1319 | "windows_aarch64_msvc", 1320 | "windows_i686_gnu", 1321 | "windows_i686_msvc", 1322 | "windows_x86_64_gnu", 1323 | "windows_x86_64_msvc", 1324 | ] 1325 | 1326 | [[package]] 1327 | name = "windows_aarch64_msvc" 1328 | version = "0.34.0" 1329 | source = "registry+https://github.com/rust-lang/crates.io-index" 1330 | checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" 1331 | 1332 | [[package]] 1333 | name = "windows_i686_gnu" 1334 | version = "0.34.0" 1335 | source = "registry+https://github.com/rust-lang/crates.io-index" 1336 | checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" 1337 | 1338 | [[package]] 1339 | name = "windows_i686_msvc" 1340 | version = "0.34.0" 1341 | source = "registry+https://github.com/rust-lang/crates.io-index" 1342 | checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" 1343 | 1344 | [[package]] 1345 | name = "windows_x86_64_gnu" 1346 | version = "0.34.0" 1347 | source = "registry+https://github.com/rust-lang/crates.io-index" 1348 | checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" 1349 | 1350 | [[package]] 1351 | name = "windows_x86_64_msvc" 1352 | version = "0.34.0" 1353 | source = "registry+https://github.com/rust-lang/crates.io-index" 1354 | checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" 1355 | 1356 | [[package]] 1357 | name = "xdg" 1358 | version = "2.4.1" 1359 | source = "registry+https://github.com/rust-lang/crates.io-index" 1360 | checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" 1361 | dependencies = [ 1362 | "dirs", 1363 | ] 1364 | 1365 | [[package]] 1366 | name = "zstd" 1367 | version = "0.10.0+zstd.1.5.2" 1368 | source = "registry+https://github.com/rust-lang/crates.io-index" 1369 | checksum = "3b1365becbe415f3f0fcd024e2f7b45bacfb5bdd055f0dc113571394114e7bdd" 1370 | dependencies = [ 1371 | "zstd-safe", 1372 | ] 1373 | 1374 | [[package]] 1375 | name = "zstd-safe" 1376 | version = "4.1.4+zstd.1.5.2" 1377 | source = "registry+https://github.com/rust-lang/crates.io-index" 1378 | checksum = "2f7cd17c9af1a4d6c24beb1cc54b17e2ef7b593dc92f19e9d9acad8b182bbaee" 1379 | dependencies = [ 1380 | "libc", 1381 | "zstd-sys", 1382 | ] 1383 | 1384 | [[package]] 1385 | name = "zstd-sys" 1386 | version = "1.6.3+zstd.1.5.2" 1387 | source = "registry+https://github.com/rust-lang/crates.io-index" 1388 | checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" 1389 | dependencies = [ 1390 | "cc", 1391 | "libc", 1392 | ] 1393 | -------------------------------------------------------------------------------- /rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "projector" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | actix-web = "4.0.1" 10 | serde = { version = "1.0.136", features = ["derive"] } 11 | serde_json = "1.0.79" 12 | structopt = "0.3.26" 13 | thiserror = "1.0.30" 14 | xdg = "2.4.1" 15 | -------------------------------------------------------------------------------- /rust/src/bin/cli.rs: -------------------------------------------------------------------------------- 1 | use projector::{error::ProjectorError, opts::{ProjectorOpts, ProjectorConfig}, operations::process}; 2 | use structopt::StructOpt; 3 | 4 | fn main() -> Result<(), ProjectorError> { 5 | let args: ProjectorConfig = ProjectorOpts::from_args().try_into()?; 6 | 7 | process(args)?; 8 | 9 | return Ok(()); 10 | } 11 | -------------------------------------------------------------------------------- /rust/src/bin/str.rs: -------------------------------------------------------------------------------- 1 | /// 2 | /// projector 3 | /// -------------------------------------- 4 | /// dynamic environments. specify variables via file path. 5 | /// 6 | /// string stuff 7 | fn main() { 8 | // string -> usize[][] 9 | let can_i_get_your_digits = get_input() 10 | .lines() 11 | .map(|line| { 12 | return line 13 | .split("") 14 | .filter(|x| x.len() > 0) 15 | .map(|x| str::parse::(x)) 16 | .map(Result::unwrap) 17 | .collect::>(); 18 | }) 19 | .collect::>>(); 20 | 21 | let dirs: [[isize; 2]; 4] = [ 22 | [-1, 0], 23 | [1, 0], 24 | [0, -1], 25 | [0, 1], 26 | ]; 27 | 28 | let rows = can_i_get_your_digits.len(); 29 | let cols = can_i_get_your_digits.get(0).unwrap().len(); 30 | 31 | println!("THE VALUE IS {}", (0usize..rows) 32 | .flat_map(|row| { 33 | return (0usize..cols).map(move |col| { 34 | return (row, col); 35 | }); 36 | }) 37 | .filter_map(|(row, col)| { 38 | let value = can_i_get_your_digits.get(row).unwrap().get(col).unwrap(); 39 | let mut found = true; 40 | for idx in 0..dirs.len() { 41 | let row = row.saturating_add(dirs[idx][0] as usize); 42 | let col = col.saturating_add(dirs[idx][1] as usize); 43 | 44 | let row = can_i_get_your_digits.get(row); 45 | if row.is_none() { 46 | continue; 47 | } 48 | 49 | let row = row.unwrap(); 50 | let col = row.get(col); 51 | if col.is_none() { 52 | continue; 53 | } 54 | let v = col.unwrap(); 55 | 56 | found = value < v; 57 | 58 | if !found { 59 | break; 60 | } 61 | } 62 | 63 | return match found { 64 | true => Some(value), 65 | _ => None 66 | }; 67 | }). 68 | sum::()); 69 | 70 | return; 71 | } 72 | 73 | fn get_input() -> String { 74 | return "2199943210 75 | 3987894921 76 | 9856789892 77 | 8767896789 78 | 9899965678".to_string(); 79 | } 80 | 81 | 82 | 83 | // My path 84 | // 85 | // Learning a new language 86 | // * string processing 87 | -------------------------------------------------------------------------------- /rust/src/bin/web.rs: -------------------------------------------------------------------------------- 1 | use actix_web::{get, web, App, HttpServer}; 2 | 3 | // This struct represents state 4 | struct AppState { 5 | app_name: String, 6 | } 7 | 8 | #[get("/")] 9 | async fn index(data: web::Data) -> String { 10 | let app_name = &data.app_name; // <- get app_name 11 | format!("Hello {app_name}!") // <- response with app_name 12 | } 13 | 14 | #[actix_web::main] 15 | async fn main() -> std::io::Result<()> { 16 | HttpServer::new(|| { 17 | App::new() 18 | .app_data(web::Data::new(AppState { 19 | app_name: String::from("Actix-web"), 20 | })) 21 | .service(index) 22 | }) 23 | .bind(("127.0.0.1", 8080))? 24 | .run() 25 | .await 26 | } 27 | 28 | -------------------------------------------------------------------------------- /rust/src/config.rs: -------------------------------------------------------------------------------- 1 | use std::{path::{PathBuf, Path}, fs::File, collections::HashMap}; 2 | 3 | use serde::{Serialize, Deserialize}; 4 | 5 | use crate::error::ProjectorError; 6 | 7 | #[derive(Deserialize, Debug, Serialize)] 8 | pub struct Config { 9 | pub links: HashMap>, 10 | pub projector: HashMap>, 11 | } 12 | 13 | impl Config { 14 | 15 | pub fn new() -> Config { 16 | return Config { 17 | links: HashMap::new(), 18 | projector: HashMap::new(), 19 | } 20 | } 21 | 22 | pub fn from_file(file: File) -> Result { 23 | return Ok(serde_json::from_reader(file)?); 24 | } 25 | 26 | pub fn remove(&mut self, dir: &PathBuf, key: &str) { 27 | if let Some(hash_map) = self.projector.get_mut(dir) { 28 | hash_map.remove(key); 29 | } 30 | } 31 | 32 | pub fn add(&mut self, dir: &PathBuf, key: &str, value: &str) { 33 | if !self.projector.contains_key(dir) { 34 | self.projector.insert(dir.clone(), HashMap::new()); 35 | } 36 | 37 | self.projector 38 | .get_mut(dir) 39 | .expect("should always exist") 40 | .insert(key.to_string(), value.to_string()); 41 | } 42 | 43 | pub fn get_value(&self, path: &PathBuf, key: &str) -> Option { 44 | let mut p: Option<&Path> = Some(path); 45 | let mut value = None; 46 | 47 | loop { 48 | // TODO: Think about windows path separator 49 | // ^--- this is a joke.. 50 | if p.is_none() { 51 | break; 52 | } 53 | 54 | let path_map = self.projector.get(p.unwrap()); 55 | if path_map.is_some() { 56 | if let Some(v) = path_map.unwrap().get(key) { 57 | value = Some(v.to_string()); 58 | break; 59 | } 60 | } 61 | 62 | p = p.unwrap().parent(); 63 | } 64 | 65 | if value.is_some() { 66 | return value; 67 | } 68 | 69 | for link in self.links.get(path).iter().flat_map(|x| x.iter()) { 70 | let path_map = self.projector.get(link); 71 | if path_map.is_some() { 72 | if let Some(v) = path_map.unwrap().get(key) { 73 | value = Some(v.to_string()); 74 | break; 75 | } 76 | } 77 | } 78 | 79 | return value; 80 | } 81 | } 82 | 83 | fn default_config_path() -> Result { 84 | let xdg_dirs = xdg::BaseDirectories::with_prefix("projector")?; 85 | return Ok(xdg_dirs.place_config_file("projector.json")?); 86 | } 87 | 88 | pub fn get_config_path(config: Option) -> Result { 89 | return Ok(match config { 90 | Some(cfg) => cfg, 91 | None => default_config_path()?, 92 | }); 93 | } 94 | 95 | #[cfg(test)] 96 | mod test { 97 | use std::path::PathBuf; 98 | 99 | use super::*; 100 | 101 | #[test] 102 | fn test_get_config_with_parameter() -> Result<(), Box> { 103 | let config = get_config_path(Some(PathBuf::from("/foo/bar/projector.json")))?; 104 | assert_eq!(config, PathBuf::from("/foo/bar/projector.json")); 105 | 106 | return Ok(()); 107 | } 108 | 109 | #[test] 110 | fn test_get_config() -> Result<(), Box> { 111 | let config = get_config_path(None)?; 112 | assert_eq!(config, default_config_path()?); 113 | 114 | return Ok(()); 115 | } 116 | 117 | fn get_config() -> (Config, PathBuf, PathBuf) { 118 | let mut config = Config::new(); 119 | 120 | let path = PathBuf::from("/home/test"); 121 | let path2 = PathBuf::from("/home/test/foo"); 122 | 123 | config.projector.insert( 124 | path.clone(), 125 | HashMap::from([ 126 | ("foo".to_string(), "baz".to_string()), 127 | ]) 128 | ); 129 | 130 | config.projector.insert( 131 | path2.clone(), 132 | HashMap::from([ 133 | ("foo".to_string(), "baz2".to_string()), 134 | ("buzz".to_string(), "baz".to_string()), 135 | ]) 136 | ); 137 | 138 | return (config, path, path2); 139 | } 140 | 141 | #[test] 142 | fn test_get_value() -> Result<(), Box> { 143 | let (config, path, path2) = get_config(); 144 | 145 | assert_eq!(config.get_value(&path, "foo"), Some("baz".to_string())); 146 | assert_eq!(config.get_value(&path2, "foo"), Some("baz2".to_string())); 147 | 148 | return Ok(()); 149 | } 150 | 151 | #[test] 152 | fn add_value() -> Result<(), ProjectorError> { 153 | let (mut config, path, path2) = get_config(); 154 | 155 | config.add(&path, "foo", "bar"); 156 | 157 | assert_eq!(config.get_value(&path, "foo"), Some("bar".to_string())); 158 | assert_eq!(config.get_value(&path2, "foo"), Some("baz2".to_string())); 159 | 160 | return Ok(()); 161 | } 162 | 163 | #[test] 164 | fn remove_value() -> Result<(), ProjectorError> { 165 | let (mut config, path, _) = get_config(); 166 | 167 | assert_eq!(config.get_value(&path, "foo"), Some("baz".to_string())); 168 | 169 | config.remove(&path, "foo"); 170 | 171 | assert_eq!(config.get_value(&path, "foo"), None); 172 | 173 | return Ok(()); 174 | } 175 | 176 | } 177 | 178 | -------------------------------------------------------------------------------- /rust/src/error.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | 3 | #[derive(Error, Debug)] 4 | pub enum ProjectorError { 5 | #[error("attempting to get xdg_config_directory and failed.")] 6 | XDGError(#[from] xdg::BaseDirectoriesError), 7 | 8 | #[error("an io error?")] 9 | IOError(#[from] std::io::Error), 10 | 11 | #[error("serde json decoding error")] 12 | SerdeJsonError(#[from] serde_json::Error), 13 | 14 | #[error("invalid argument count (expected {expected:?}, found {found:?})")] 15 | InvalidArguments{ 16 | expected: usize, 17 | found: usize, 18 | }, 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /rust/src/file.rs: -------------------------------------------------------------------------------- 1 | use std::{fs::File, path::PathBuf}; 2 | 3 | use crate::error::ProjectorError; 4 | 5 | pub fn open_or_create(path: &PathBuf) -> Result { 6 | return Ok(File::options().read(true).write(true).create(true).open(path)?); 7 | } 8 | 9 | 10 | -------------------------------------------------------------------------------- /rust/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod error; 2 | pub mod operations; 3 | pub mod opts; 4 | pub mod config; 5 | pub mod file; 6 | 7 | -------------------------------------------------------------------------------- /rust/src/operations/add.rs: -------------------------------------------------------------------------------- 1 | use crate::{error::ProjectorError, opts::ProjectorConfig}; 2 | 3 | pub fn add(cfg: &mut ProjectorConfig) -> Result<(), ProjectorError> { 4 | if cfg.terms.len() != 2 { 5 | return Err(ProjectorError::InvalidArguments{ 6 | expected: 2, 7 | found: cfg.terms.len(), 8 | }); 9 | } 10 | 11 | let key = cfg.terms.get(0).expect("expect key to exist"); 12 | let value = cfg.terms.get(1).expect("expect value to exist"); 13 | 14 | // todo: i don't like this. 15 | cfg.config.add(&cfg.pwd, key, value); 16 | 17 | return Ok(()); 18 | } 19 | 20 | #[cfg(test)] 21 | mod test { 22 | use std::path::PathBuf; 23 | 24 | use crate::{error::ProjectorError, opts::ProjectorConfig, config::Config, operations::{operation::Operation, add}}; 25 | 26 | fn get_config(terms: Vec) -> (ProjectorConfig, PathBuf) { 27 | let pwd = PathBuf::from("/foo/bar/baz"); 28 | let config = ProjectorConfig { 29 | pwd: pwd.clone(), 30 | config: Config::new(), 31 | operation: Operation::Add, 32 | terms, 33 | }; 34 | 35 | return (config, pwd); 36 | } 37 | 38 | #[test] 39 | fn test_add_with_not_enough_terms() -> Result<(), ProjectorError> { 40 | let (mut config, _) = get_config(vec![ 41 | String::from("foo"), 42 | ]); 43 | 44 | // TODO: How to test? 45 | let out = add(&mut config); 46 | assert_eq!(out.is_ok(), false); 47 | 48 | return Ok(()); 49 | } 50 | 51 | #[test] 52 | fn test_add_with_too_many_terms() -> Result<(), ProjectorError> { 53 | let (mut config, _) = get_config(vec![ 54 | String::from("foo"), 55 | String::from("foo"), 56 | String::from("foo"), 57 | ]); 58 | 59 | // TODO: How to test? 60 | let out = add(&mut config); 61 | assert_eq!(out.is_ok(), false); 62 | 63 | return Ok(()); 64 | } 65 | 66 | #[test] 67 | fn test_add() -> Result<(), ProjectorError> { 68 | let (mut config, path) = get_config(vec![ 69 | String::from("foo"), 70 | String::from("bar"), 71 | ]); 72 | 73 | let out = add(&mut config); 74 | assert_eq!(out.is_ok(), true); 75 | assert_eq!(config.config.get_value(&path, "foo"), Some(String::from("bar"))); 76 | 77 | return Ok(()); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /rust/src/operations/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::{error::ProjectorError, opts::ProjectorConfig}; 2 | 3 | use self::{add::add, remove::remove}; 4 | 5 | pub mod operation; 6 | pub mod add; 7 | pub mod remove; 8 | 9 | pub fn process(mut opts: ProjectorConfig) -> Result<(), ProjectorError> { 10 | 11 | match opts.operation { 12 | operation::Operation::Add => add(&mut opts)?, 13 | operation::Operation::Remove => remove(&mut opts)?, 14 | operation::Operation::Link => unreachable!(), 15 | operation::Operation::Unlink => unreachable!(), 16 | _ => unreachable!(), 17 | }; 18 | 19 | return Ok(()); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /rust/src/operations/operation.rs: -------------------------------------------------------------------------------- 1 | use std::str::FromStr; 2 | 3 | use crate::error::ProjectorError; 4 | 5 | #[derive(Debug, Clone)] 6 | pub enum Operation { 7 | Add, 8 | Remove, 9 | Link, 10 | Unlink, 11 | Search(String), 12 | } 13 | 14 | impl FromStr for Operation { 15 | type Err = ProjectorError; 16 | 17 | fn from_str(s: &str) -> Result { 18 | return Ok(match s { 19 | "add" => Operation::Add, 20 | "rm" => Operation::Remove, 21 | "link" => Operation::Link, 22 | "unlink" => Operation::Unlink, 23 | _ => Operation::Search(s.to_string()) 24 | }); 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /rust/src/operations/remove.rs: -------------------------------------------------------------------------------- 1 | use crate::{opts::ProjectorConfig, error::ProjectorError}; 2 | 3 | 4 | pub fn remove(cfg: &mut ProjectorConfig) -> Result<(), ProjectorError> { 5 | 6 | if cfg.terms.len() != 1 { 7 | return Err(ProjectorError::InvalidArguments{ 8 | expected: 1, 9 | found: cfg.terms.len(), 10 | }); 11 | } 12 | 13 | cfg.config.remove(&cfg.pwd, &cfg.terms[0]); 14 | 15 | return Ok(()); 16 | } 17 | 18 | #[cfg(test)] 19 | mod test { 20 | use std::path::PathBuf; 21 | 22 | use crate::{error::ProjectorError, opts::ProjectorConfig, config::Config, operations::operation::Operation}; 23 | 24 | use super::remove; 25 | 26 | // TODO: I should probably make sure that I actually do something other than copy pasta. 27 | fn get_config(terms: Vec) -> (ProjectorConfig, PathBuf) { 28 | let pwd = PathBuf::from("/foo/bar/baz"); 29 | let config = ProjectorConfig { 30 | pwd: pwd.clone(), 31 | config: Config::new(), 32 | operation: Operation::Add, 33 | terms, 34 | }; 35 | 36 | return (config, pwd); 37 | } 38 | 39 | 40 | #[test] 41 | fn test_remove() -> Result<(), ProjectorError> { 42 | let (mut config, pwd) = get_config(vec!["foo".to_string()]); 43 | 44 | config.config.add(&pwd, "foo", "bar"); 45 | config.config.add(&pwd, "baz", "piq"); 46 | remove(&mut config)?; 47 | 48 | assert_eq!(config.config.get_value(&pwd, "foo"), None); 49 | assert_eq!(config.config.get_value(&pwd, "baz"), Some(String::from("piq"))); 50 | 51 | return Ok(()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /rust/src/opts.rs: -------------------------------------------------------------------------------- 1 | use std::{path::PathBuf, fs::File}; 2 | 3 | use structopt::StructOpt; 4 | 5 | use crate::{operations::operation::Operation, error::ProjectorError, file::open_or_create, config::{get_config_path, Config}}; 6 | 7 | #[derive(Debug, StructOpt, Clone)] 8 | pub struct ProjectorOpts { 9 | 10 | /// The port to use for the events to be served on 11 | #[structopt(long = "pwd")] 12 | pub pwd: Option, 13 | 14 | /// The port to use for the events to be served on 15 | #[structopt(long = "config")] 16 | pub config: Option, 17 | 18 | /// The operation to perform. 19 | /// It is either a keyword, or its a search term 20 | #[structopt()] 21 | pub operation: Operation, 22 | 23 | /// Any other arguments for the operation 24 | /// 25 | /// add: 2 arguments, the key and the value. 26 | /// remove: 1 argument, the key 27 | /// link: 1 arguments, the directory to link 28 | /// unlink: 1 argumentes, the directory to unlink 29 | /// search terms: zero or more search terms to search in this projector path 30 | #[structopt()] 31 | pub args: Vec, 32 | } 33 | 34 | pub struct ProjectorConfig { 35 | pub pwd: PathBuf, 36 | pub config: Config, 37 | pub operation: Operation, 38 | pub terms: Vec, 39 | } 40 | 41 | impl TryFrom for ProjectorConfig { 42 | type Error = ProjectorError; 43 | 44 | fn try_from(value: ProjectorOpts) -> Result { 45 | let pwd = value.pwd.unwrap_or(std::env::current_dir()?); 46 | 47 | let config = get_config_path(value.config)?; 48 | let config = open_or_create(&config)?; 49 | let config = Config::from_file(config)?; 50 | 51 | return Ok(ProjectorConfig { 52 | pwd, 53 | config, 54 | operation: value.operation, 55 | terms: value.args, 56 | }); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /typescript/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ 2 | module.exports = { 3 | preset: 'ts-jest', 4 | testEnvironment: 'node', 5 | transform: {"\\.ts$": ['ts-jest']} 6 | }; 7 | -------------------------------------------------------------------------------- /typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@types/jest": "^27.4.1", 8 | "@types/node": "^17.0.23", 9 | "command-line-args": "^5.2.1", 10 | "jest": "^27.5.1", 11 | "ts-jest": "^27.1.4", 12 | "ts-node": "^10.7.0", 13 | "typescript": "^4.6.3", 14 | "xdg-basedir": "^5.1.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typescript/src/__tests__/config.ts: -------------------------------------------------------------------------------- 1 | import Config from "../config"; 2 | 3 | const path = "/foo/bar"; 4 | test("test config get by pwd", function() { 5 | const config = Config.new(); 6 | expect(config.getValue(path, "baz")).toEqual(undefined); 7 | 8 | config.addValue(path, "baz", "fortran"); 9 | expect(config.getValue(path, "baz")).toEqual("fortran"); 10 | }); 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /typescript/src/__tests__/opts.ts: -------------------------------------------------------------------------------- 1 | import { getOperation, getTerms, Operation } from "../opts"; 2 | 3 | 4 | test("getTerms happy path", function() { 5 | const terms = ["foo", "bar"]; 6 | const parsedTerms = getTerms(terms); 7 | expect(parsedTerms).toEqual(["foo", "bar"]); 8 | }); 9 | 10 | test("with print operation", function() { 11 | const terms = ["print", "foo", "bar"]; 12 | const parsedTerms = getTerms(terms); 13 | expect(parsedTerms).toEqual(["foo", "bar"]); 14 | }); 15 | 16 | test("with other operation", function() { 17 | const terms = ["add", "foo", "bar"]; 18 | const parsedTerms = getTerms(terms); 19 | expect(parsedTerms).toEqual(["foo", "bar"]); 20 | }); 21 | 22 | test("getOperation add", function() { 23 | const terms = ["add", "foo", "bar"]; 24 | const operation = getOperation(terms); 25 | expect(operation).toEqual(Operation.Add); 26 | }); 27 | 28 | test("getOperation default", function() { 29 | const terms = ["blah", "foo", "bar"]; 30 | const operation = getOperation(terms); 31 | expect(operation).toEqual(Operation.Print); 32 | }); 33 | -------------------------------------------------------------------------------- /typescript/src/config.ts: -------------------------------------------------------------------------------- 1 | import * as fs from "fs"; 2 | import * as path from "path"; 3 | 4 | type MapOfStrings = Map; 5 | type Links = Map; 6 | 7 | type ConfigFromFile = { 8 | links: Links, 9 | projector: Map, 10 | } 11 | 12 | export default class Config { 13 | private constructor( 14 | private links: Links, 15 | private projector: Map, 16 | ) { } 17 | 18 | public getValue(pwd: string, key: string): string | undefined { 19 | let curr = pwd; 20 | do { 21 | const value = this._getValue(curr, key); 22 | if (value !== undefined) { 23 | return value; 24 | } 25 | 26 | const nextPwd = path.dirname(curr); 27 | if (nextPwd === curr) { 28 | break; 29 | } 30 | curr = nextPwd; 31 | } while (true); 32 | 33 | const links = this.links.get(pwd); 34 | if (!links) { 35 | return undefined; 36 | } 37 | 38 | for (const link of links) { 39 | const value = this._getValue(link, key); 40 | if (value !== undefined) { 41 | return value; 42 | } 43 | } 44 | } 45 | 46 | public addValue(pwd: string, key: string, value: string): void { 47 | if (!this.projector.has(pwd)) { 48 | this.projector.set(pwd, new Map()); 49 | } 50 | this.projector.get(pwd).set(key, value); 51 | } 52 | 53 | public removeValue(pwd: string, key: string): void { 54 | if (!this.projector.has(pwd)) { 55 | return; 56 | } 57 | 58 | this.projector.get(pwd).delete(key); 59 | } 60 | 61 | private _getValue(pwd: string, key: string): string | undefined { 62 | const values = this.projector.get(pwd); 63 | if (!values) { 64 | return undefined 65 | } 66 | 67 | return values.get(key) 68 | } 69 | 70 | static fromFile(file: string): Config { 71 | if (!fs.existsSync(file)) { 72 | fs.writeFileSync(file, "{\"links\": {}, \"projector\": {}}"); 73 | } 74 | 75 | const contents = JSON.parse(fs.readFileSync(file).toString()) as ConfigFromFile; 76 | return new Config(contents.links, contents.projector); 77 | } 78 | 79 | static new(): Config { 80 | return new Config(new Map(), new Map()); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /typescript/src/main.ts: -------------------------------------------------------------------------------- 1 | import * as cla from "command-line-args"; 2 | import createConfig from "./opts"; 3 | import projector from "./operation"; 4 | 5 | const optionDefinitions = [ 6 | { name: 'config', alias: 'c', type: String }, 7 | { name: 'pwd', alias: 'p', type: String }, 8 | { name: 'command', type: String, defaultOption: true, multiple: true }, 9 | ] 10 | 11 | const config = createConfig(cla(optionDefinitions)); 12 | projector(config); 13 | 14 | 15 | -------------------------------------------------------------------------------- /typescript/src/operation/__tests__/add.ts: -------------------------------------------------------------------------------- 1 | import projector from "../"; 2 | import Config from "../../config"; 3 | import { Operation, ProjectorConfig } from "../../opts"; 4 | 5 | const pwd = "/foo/bar"; 6 | test("add via projector", function() { 7 | const config = Config.new(); 8 | const projectorConfig: ProjectorConfig = { 9 | pwd, 10 | config, 11 | terms: ["foo", "kekw"], 12 | operation: Operation.Add, 13 | } 14 | 15 | config.addValue(pwd, "foo", "bar"); 16 | config.addValue(pwd, "baz", "piq"); 17 | 18 | projector(projectorConfig); 19 | 20 | expect(config.getValue(pwd, "foo")).toEqual("kekw"); 21 | }); 22 | -------------------------------------------------------------------------------- /typescript/src/operation/__tests__/remove.ts: -------------------------------------------------------------------------------- 1 | import projector from "../"; 2 | import Config from "../../config"; 3 | import { Operation, ProjectorConfig } from "../../opts"; 4 | 5 | const pwd = "/foo/bar"; 6 | test("add via projector", function() { 7 | const config = Config.new(); 8 | const projectorConfig: ProjectorConfig = { 9 | pwd, 10 | config, 11 | terms: ["foo"], 12 | operation: Operation.Remove, 13 | } 14 | 15 | config.addValue(pwd, "foo", "bar"); 16 | config.addValue(pwd, "baz", "piq"); 17 | 18 | projector(projectorConfig); 19 | 20 | expect(config.getValue(pwd, "foo")).toEqual(undefined); 21 | }); 22 | -------------------------------------------------------------------------------- /typescript/src/operation/add.ts: -------------------------------------------------------------------------------- 1 | import { ProjectorConfig } from "../opts"; 2 | 3 | export default function add(config: ProjectorConfig): any { 4 | if (config.terms.length !== 2) { 5 | const len = config.terms.length; 6 | throw new Error( 7 | `Please provide the correct amount of arguments. Provided ${len} expected 2`); 8 | } 9 | 10 | config.config.addValue(config.pwd, config.terms[0], config.terms[1]); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /typescript/src/operation/index.ts: -------------------------------------------------------------------------------- 1 | import { Operation, ProjectorConfig } from "../opts"; 2 | import add from "./add"; 3 | import remove from "./remove"; 4 | 5 | type OperationFn = (config: ProjectorConfig) => unknown; 6 | const operations = new Map([ 7 | [Operation.Add, add], 8 | [Operation.Remove, remove], 9 | ]); 10 | 11 | export default function projector(config: ProjectorConfig) { 12 | operations.get(config.operation)(config); 13 | } 14 | -------------------------------------------------------------------------------- /typescript/src/operation/remove.ts: -------------------------------------------------------------------------------- 1 | import { ProjectorConfig } from "../opts"; 2 | 3 | export default function remove(config: ProjectorConfig): any { 4 | if (config.terms.length !== 1) { 5 | const len = config.terms.length; 6 | throw new Error( 7 | `Please provide the correct amount of arguments. Provided ${len} expected 1`); 8 | } 9 | 10 | config.config.removeValue(config.pwd, config.terms[0]); 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /typescript/src/opts.ts: -------------------------------------------------------------------------------- 1 | import * as path from "path"; 2 | import Config from "./config"; 3 | 4 | export type CLIOptions = { 5 | command: string[], 6 | config?: string, 7 | pwd?: string, 8 | } 9 | 10 | export enum Operation { 11 | Add, 12 | Remove, 13 | Link, 14 | Unlink, 15 | Print, 16 | } 17 | 18 | export type ProjectorConfig = { 19 | pwd: string, 20 | config: Config, 21 | operation: Operation, 22 | terms: string[], 23 | } 24 | 25 | export function getProjectorConfigDir(config?: string): string { 26 | const xdgPath = process.env["XDG_CONFIG_HOME"]; 27 | 28 | if (!xdgPath) { 29 | throw new Error("Start using an operating system with xdg you goof"); 30 | } 31 | return config || path.join(xdgPath, "projector", "projector.json"); 32 | } 33 | 34 | export function getOperation(operation: string[]): Operation { 35 | switch (operation[0]) { 36 | case "add": return Operation.Add; 37 | case "rm": return Operation.Remove; 38 | case "link": return Operation.Link; 39 | case "unlink": return Operation.Unlink; 40 | } 41 | 42 | return Operation.Print; 43 | } 44 | 45 | export function isOperationSpecified(operation: string[]): boolean { 46 | return getOperation(operation) !== Operation.Print || 47 | operation[0] === "print"; 48 | } 49 | 50 | export function getTerms(operation: string[]): string[] { 51 | return isOperationSpecified(operation) ? operation.slice(1) : operation; 52 | } 53 | 54 | export default function createConfig(options: CLIOptions): ProjectorConfig { 55 | return { 56 | pwd: options.pwd || process.cwd(), 57 | config: Config.fromFile(getProjectorConfigDir(options.config)), 58 | operation: getOperation(options.command), 59 | terms: getTerms(options.command), 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /typescript/yarn-error.log: -------------------------------------------------------------------------------- 1 | Arguments: 2 | /home/mpaulson/.local/n/bin/node /home/mpaulson/.local/.npm-global/bin/yarn add typescript tsserver ts-node 3 | 4 | PATH: 5 | /home/mpaulson/.deno:/home/mpaulson/go/bin:/home/mpaulson/.local/go/bin:/home/mpaulson/.local/n/bin/:/home/mpaulson/.local/.npm-global/bin:/opt/nf-tvui-spriter-deps/bin:/usr/lib/ccache:/home/theprimeagen/n/bin:/home/mpaulson/.cargo/bin:/home/mpaulson/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/theprimeagen/personal/lua-language-server/bin/Linux:/usr/local/go/bin:/home/mpaulson/work/wrapper:/usr/local/netflix/tvui-automation-analyzer:/usr/local/netflix/encoders/bin/:/home/mpaulson/.yarn/bin:/usr/lib/llvm-8/bin:/home/mpaulson/personal/uhh/build:/home/mpaulson/.rustup 6 | 7 | Yarn version: 8 | 1.22.17 9 | 10 | Node version: 11 | 17.5.0 12 | 13 | Platform: 14 | linux x64 15 | 16 | Trace: 17 | Error: https://registry.yarnpkg.com/tsserver: Not found 18 | at Request.params.callback [as _callback] (/home/mpaulson/.local/.npm-global/lib/node_modules/yarn/lib/cli.js:67029:18) 19 | at Request.self.callback (/home/mpaulson/.local/.npm-global/lib/node_modules/yarn/lib/cli.js:140883:22) 20 | at Request.emit (node:events:526:28) 21 | at Request. (/home/mpaulson/.local/.npm-global/lib/node_modules/yarn/lib/cli.js:141855:10) 22 | at Request.emit (node:events:526:28) 23 | at IncomingMessage. (/home/mpaulson/.local/.npm-global/lib/node_modules/yarn/lib/cli.js:141777:12) 24 | at Object.onceWrapper (node:events:645:28) 25 | at IncomingMessage.emit (node:events:538:35) 26 | at endReadableNT (node:internal/streams/readable:1342:12) 27 | at processTicksAndRejections (node:internal/process/task_queues:83:21) 28 | 29 | npm manifest: 30 | { 31 | "name": "typescript", 32 | "version": "1.0.0", 33 | "main": "index.js", 34 | "license": "MIT", 35 | "dependencies": { 36 | "ts-node": "^10.7.0", 37 | "typescript": "^4.6.3" 38 | } 39 | } 40 | 41 | yarn manifest: 42 | No manifest 43 | 44 | Lockfile: 45 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 46 | # yarn lockfile v1 47 | 48 | 49 | "@cspotcode/source-map-consumer@0.8.0": 50 | version "0.8.0" 51 | resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" 52 | integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== 53 | 54 | "@cspotcode/source-map-support@0.7.0": 55 | version "0.7.0" 56 | resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" 57 | integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== 58 | dependencies: 59 | "@cspotcode/source-map-consumer" "0.8.0" 60 | 61 | "@tsconfig/node10@^1.0.7": 62 | version "1.0.8" 63 | resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" 64 | integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== 65 | 66 | "@tsconfig/node12@^1.0.7": 67 | version "1.0.9" 68 | resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" 69 | integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== 70 | 71 | "@tsconfig/node14@^1.0.0": 72 | version "1.0.1" 73 | resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" 74 | integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== 75 | 76 | "@tsconfig/node16@^1.0.2": 77 | version "1.0.2" 78 | resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" 79 | integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== 80 | 81 | acorn-walk@^8.1.1: 82 | version "8.2.0" 83 | resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" 84 | integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== 85 | 86 | acorn@^8.4.1: 87 | version "8.7.0" 88 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" 89 | integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== 90 | 91 | arg@^4.1.0: 92 | version "4.1.3" 93 | resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" 94 | integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== 95 | 96 | create-require@^1.1.0: 97 | version "1.1.1" 98 | resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" 99 | integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== 100 | 101 | diff@^4.0.1: 102 | version "4.0.2" 103 | resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" 104 | integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== 105 | 106 | make-error@^1.1.1: 107 | version "1.3.6" 108 | resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" 109 | integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== 110 | 111 | ts-node@^10.7.0: 112 | version "10.7.0" 113 | resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" 114 | integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A== 115 | dependencies: 116 | "@cspotcode/source-map-support" "0.7.0" 117 | "@tsconfig/node10" "^1.0.7" 118 | "@tsconfig/node12" "^1.0.7" 119 | "@tsconfig/node14" "^1.0.0" 120 | "@tsconfig/node16" "^1.0.2" 121 | acorn "^8.4.1" 122 | acorn-walk "^8.1.1" 123 | arg "^4.1.0" 124 | create-require "^1.1.0" 125 | diff "^4.0.1" 126 | make-error "^1.1.1" 127 | v8-compile-cache-lib "^3.0.0" 128 | yn "3.1.1" 129 | 130 | typescript@^4.6.3: 131 | version "4.6.3" 132 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c" 133 | integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== 134 | 135 | v8-compile-cache-lib@^3.0.0: 136 | version "3.0.0" 137 | resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" 138 | integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== 139 | 140 | yn@3.1.1: 141 | version "3.1.1" 142 | resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" 143 | integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== 144 | --------------------------------------------------------------------------------