tailcall
                                
                                
                                
                                    tailcall copied to clipboard
                            
                            
                            
                        Simplify init subcommand
Is your feature request related to a problem? Please describe. Following on from our discussion in discord.
- The first question doesn't make too much sense to me. If I didn't mean to call the command, I would cancel the command. It also errors if the directory doesn't exist.
 - If the directory I'm targeting doesn't exist, init should create the directory
 - I wasn't initially aware that init created 2 hidden files, as well as an empty file with the name of the schema I wanted
 
Feel free to break this up into smaller tickets, especially the last point.
Describe the solution you'd like
- Remove the first question
 - Create the directory (or at least ask if I want it created if it doesn't already exist)
 - Some output of what was created would be helpful (I appreciate this is in the docs already), or maybe expand on the help section of the subcommand.
 
Describe alternatives you've considered See above (for the or)
Additional context
Diagram should be amended to say errors if the user presses no at first and the dir doesn't exist.
May be we can just stick to generating a .tailcallrc.graphql file every time someone says init. Ask the user if it can be overwritten incase it already exists. The rest of the stuff is quite opinionated, confusing and would rather keep it in the tailcall documentation than integrating in the CLI. Let me know what you think.
I'd still highlight to the user a file is going to be created for .tailcall.graphql, but otherwise that sounds really good.
Perfect. Can you please update the issue with the exact requirements?
/bounty 100$
💎 $100 bounty created by tailcallhq
🙋 If you'd like to work on this issue, comment below to get assigned
👉 To claim this bounty, submit a pull request that includes the text /claim #698 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country
💵 Payment arrives in your account 2-5 days after the bounty is rewarded
💯 You keep 100% of the bounty award
🙏 Thank you for contributing to tailcallhq/tailcall!
🙋♂️ Join our discord channel if you need help.
can i be assigned this issue? @tusharmath
💡 @neo773 submitted a pull request that claims the bounty. You can visit your bounty board to reward.
@meskill This is the overall flow I am thinking (psuedo rust code) —
run the tailcall init command
tc_rc = fs::exist(".tailcallrc.graphql")
gq_rc = fs::exist(".graphqlrc.yml")
if gq_rc {
  if tc_rc {
    match confirm_overwrite() {
      YES => write(tc_rc),
      No  => ()
    };
  }
} else {
  write(gq_rc);
  write(tc_rc);
}
if !gq_rc.contains(tc_rc) {
  match confirm_update() {
    YES => write(gq_rc);
    No  => write(gq_rc);
  }
}
                                    
                                    
                                    
                                
@tusharmath mostly agree.
just small adjustments:
- first two nested ifs should be separated since if .tailcallrc.graphql exists we need to ask for overwrite permission anyway
 - in both No actions we should do nothing
 
@meskill This is the overall flow I am thinking (psuedo rust code) —
There is an updated version of the pseudocode
let mut tc_rc = fs::exist(".tailcallrc.graphql")
let mut gq_rc = fs::exist(".graphqlrc.yml")
if gq_rc {
  tc_rc = gq_rc.get_tc_rc();  
} else {
  write(gq_rc);
}
if tc_rc {
  match confirm_overwrite() {
    YES => write(tc_rc),
    No  => ()
  };
} else {
  write(tc_rc);
}
if !gq_rc.contains(tc_rc) {
  match confirm_update() {
    YES => write(gq_rc);
    No  => ();
  }
}
                                    
                                    
                                    
                                
/attempt #698
@ologbonowiwi: The Tailcall Inc. team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.
💡 @ologbonowiwi and @neo773 submitted a pull request that claims the bounty. You can visit your bounty board to reward.
@ologbonowiwi: Your claim has been rewarded! We'll notify you once it is processed.
🎉🎈 @neo773 has been awarded $50! 🎈🎊
🎉🎈 @ologbonowiwi has been awarded $50! 🎈🎊