-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Batch #2 #5
Conversation
…e for main binary
@zph it looks like there's some conflicts that keep the diff from showing vs the newly-merged code, so I can a code review once that's merged in. Regarding the UX of the CLI itself: Here are my high level design considerations and thoughts:
Given these considerations, I'm wondering if we should perhaps start with a |
A design doc together sounds great. I can reply and fill in details there later today 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toumorokoshi I fixed the merge conflicts but I've lost the front of mind context of these changes and this is a big PR.
We will work through the design doc, then maybe I can split out this PR into pieces to shrink the merge size.
@@ -6,9 +6,9 @@ edition = "2018" | |||
license = "MIT" | |||
|
|||
[dependencies] | |||
tui = "0.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed because they didn't look used.
termion = "*" | ||
|
||
|
||
clap = "3.0.0-beta.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chose beta because of most up to date auto-generated shell completions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine, ultimately we produce a compiled binary so the use of beta internally is less of an issue I think.
|
||
set -eou pipefail | ||
|
||
cargo test --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience scripts, we can skip if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasoning for them: never needing to wonder how to do an action in a given project when moving between projects or when new people contribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion. I've seen Makefiles used for this purpose as well, but we can always clean up if things get unwieldy.
|
||
macro_rules! help_template { | ||
() => { | ||
r#"echo -e | ||
'This is an instance of tome, running against the directory {}. | ||
\nThe commands are namespaced by the directory structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified the escaping by printing this directly via eprintln vs trying to echo it.
} | ||
} | ||
}; | ||
let shell_env = env::var("SHELL").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: move away entirely from trying to infer shell. Ask user to supply it :)
consuming_help = false; | ||
} else if let Some(rest) = line.strip_prefix("# ") { | ||
} else if line.contains("# ") || line.contains("// ") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: generalize this to other common prefixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you suggesting we should support other comment prefixes (e.g. '!' or ';') as well?
I think that seems reasonable. I would prefer to not get into the business of capturing multi-line comments though, since it forces us to write some level of recursive parsing or escaping.
@@ -113,7 +121,7 @@ impl Script { | |||
CommandType::Execute => { | |||
let command_string = if self.should_source { | |||
// when sourcing, just return the full body. | |||
let mut command = vec![String::from("."), self.path.clone()]; | |||
let mut command = vec![String::from("source"), self.path.clone()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reading comprehension, source
should be anbalagous to .
but more self explanatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source
is non-posix, so we should stick with dot. See the posix spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course zsh
and fish
are not completely posix compliant, but I think we should strive to use posix semantics unless we have a strong reason not to.
let mut escaped_command_string = vec![]; | ||
for mut arg in command_string { | ||
arg = arg.replace("'", "\\'"); | ||
arg.insert(0, '\''); | ||
arg.push('\''); | ||
escaped_command_string.push(arg); | ||
} | ||
// Include commandline arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were left out before.
@@ -42,7 +42,7 @@ fn test_help() { | |||
", | |||
)) as Box<dyn Read>, | |||
); | |||
assert_eq!(&script.help_string, "foo bar baz\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 should we have that newline or no?
thanks for the changes! I'll take a closer look at the code in the next couple days, especially now that #13 is in. |
@toumorokoshi Perfect. I'll tag you here when I get a chance to get back to it... likely later this week or during weekend 😄. Until then no need to spend time reviewing as it may undergo moderate change to match our spec in #13 . |
Update, I didn't get to work on it this weekend but will as schedule allows 🤗 |
Now worries, thanks for the update and staying in touch!
…On Tue, Apr 13, 2021 at 8:37 AM Zander Hill ***@***.***> wrote:
Update, I didn't get to work on it this weekend but will as schedule
allows 🤗
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC7QSEIHJKYPOMN4D3RRNLTIRQMLANCNFSM4ZL7MBWQ>
.
|
@zph happy new year! My cycles are starting to free up, so I think I want to take the step to try to get tome to 1.0 and start trying to get some buzz on it. Is it alright with you if I move forward with the design that we discussed? If you still have the cycles to contribute you're more than welcome, but don't want to burden you if you have other things going on. |
@toumorokoshi I'm excited to hear that you're freeing up for more Tome! I'm in strong support of you carrying on with the design we discussed :D. I can't offer to do much on it myself right now, but I could definitely exchange a few messages or look over code in a PR if you want me involved. Happy New Year! PS - I know a friend who's using this for their commandline tooling and can see if they're free to also try out an RC once it's near v1.0. |
Sounds great and thanks for all of your help! I'll send some pings once I scope the 1.0 milestone. |
Just wanted to pop in and say that I use tome all the time. I have 3 separate commands that I use for work stuff in different scopes and another tome that I used for my personal stuff. I appreciate all the work! |
Hello! I think all of the changes that would have been introduced in this PR have been incorporated in the main branch (use of clap, new reserved commands, fish support). With that, I think we can close this PR out. Thanks for all the help! |
WIP & TBD.
Context in #3 and #4 which contains Batch #1 of changes.
This PR are proposed changes subject to revision as we refine the good ergonomic concepts into what will merge and ship 🗡️ .
Current CLI output for
tome --help
Each subcommand has its own targeted help:
tome exec --help
Then running a subcommand:
tome commands --directory ./example
List of changes:
TODO for merge: